Code for Program to find entered number is prime number or not in C Programming

#include <stdio.h>
#include <conio.h>
void main(){
     int num,i;
     clrscr();
     printf("*****PRIME NUMBER*****\n\n");
     printf("Enter the number to find it is prime or not : ");
     scanf("%d",&num);
     for(i=2;i<num;i++){
    if(num%i==0){
       printf("\n\n%d is Not a Prime Number\n",num);
       printf("It is divisible by %d, ...",i);
       gotoout;
    }
     }
     printf("\n\n%d is a PRIME number",num);
    out:
    getch();
}

No comments:

Post a Comment