C Program to find is taken input Prime or not
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
Comments
Post a Comment