/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <stdio.h>
#include <math.h>
int isPrime(int num);
int isPrime(int num){
if(num <= 1)return 0;
for(int i=2;i <=sqrt(num); ++i){
if(num%i ==0 )return 0;
}
return 1;
}
int main()
{
int num;
printf("정수를 입력하시오 : ");
scanf("%d\n", &num);
if(isPrime(num)){
printf("%d는 소수입니다.\n",num);
}
else{
printf("%d는 소수가 아닙니다",num);
}
return 0;
}