C Program to find is taken input Prime or not

#include<stdio.h>
#include<math.h>
int main()
{
int i;
scanf("%d",&i);
if(i%2==0)
{
printf("No\n"); //2 diye vag gele prime na
goto A;
}
for(int a = 3 ; a<sqrt(i) ; a=a+2)
/* prime number square root porzonoto hisab korlei hoy
r dui diye vag jabe na mne bijor korlei hobe */
{
if(i%a==0){
printf("No\n");
goto A;
}
}
printf("Yes\n");
A: return 0;
}
view raw isPrime.c hosted with ❤ by GitHub

Comments

Popular posts from this blog

How to take input from external file in C++

Browser Cookies: What the hell is this?