C program to find that given number is prime or not.

#include<stdio.h>
#include<conio.h>
void main(){
int n,i;
clrscr();
printf("Enter a Positive Integer\n");
scanf("%d",&n);
if(n==1) 
printf("%d is Universal Prime Number\n",n);
else{
for(i=2; i<=n-1; i++){
if(n%i==0) break;
}
if(n==i) printf("%d is Prime Number\n",n);
else printf("%d is Not Prime Number\n",n);
}
getch();


}

Comments

Popular posts from this blog

C Language Topics in Hindi and English

C language IMP Questions for BSc/BA/BCom/BCA/BE/BTech/MSc/MCA (CS/IT) I year students