You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
335 B
24 lines
335 B
#include<bits/stdc++.h>
|
|
using namespace std;
|
|
|
|
int is_sushu(int n) {
|
|
int i, mid;
|
|
mid=(int)sqrt(n);
|
|
for(i=2; i<=mid; i++)
|
|
if(0 == n%i)
|
|
return 0;
|
|
return 1;
|
|
}
|
|
int main() {
|
|
int n;
|
|
|
|
printf("Enter a num: ");
|
|
scanf("%d", &n);
|
|
if(is_sushu(n))
|
|
printf("%d is sushu!\n", n);
|
|
else
|
|
printf("%d is not sushu...\n", n);
|
|
return 0;
|
|
}
|
|
|