online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
use std::io::prelude::*; fn isPrime(n: i32) -> bool { if n < 2 { return false; } // Try dividing by all numbers from 2 to sqrt(n). let mut i = 2; while i*i <= n { if n % i == 0 { return false; } i += 1; } // If we get here, we didn't find a factor, so n is prime. return true; } fn main() { print!("What is your name? "); std::io::stdout().flush(); let mut nameIn = String::new(); std::io::stdin().read_line(&mut nameIn).unwrap(); let name = nameIn.trim(); println!("Hello, {}!", name); print!("What is your favorite number? "); std::io::stdout().flush(); let mut numberIn = String::new(); std::io::stdin().read_line(&mut numberIn).unwrap(); let number: i32 = numberIn.trim().parse().unwrap(); print!("Your favorite number is {}", number); if isPrime(number) { println!(", and that's a prime number!"); } else { println!(". It's not a prime number, but that's okay!"); } }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue