34. Write a program to input an integer number and cheek whether it is prime number or not.
#include <stdio.h>
#include <conio.h>
void main()
{
int i, num;
clrscr();
printf(“\n Input any number:- ");
scanf("%d“, &num);
for(i=2; i<num; i++)
{
if(num%i==0)
{
printf("%d is non-prime number", num);
break;
}
}
if(num==i)
printf("\n %d is prime number", num);
getch();
}
No comments:
Post a Comment