#include <stdbool.h>
#include <stdio.h>
using namespace std;
bool is_simple(int count){
for(int i =2; i < count; i++){
if(count % i == 0)
return false;
}
return true;
}
int main(int argc, char * argv[]){
char * str;
do{
int count;
str = new char[30];
cin >> str;
count = atoi(str);
if(is_simple(count)){
printf("Is simple.
");
}else{
printf("Is not simple!
");
}
}while(!isalpha((int)(*str)));
return 0;
}
Comments
Leave a comment