-
Notifications
You must be signed in to change notification settings - Fork 1
/
14th_program.c
38 lines (36 loc) · 886 Bytes
/
14th_program.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Write a program to find whether enterd number is prime or not.
#include<stdio.h>
int main()
{
int no_of_nos,i,j,num,count=0;
printf("Enter,how many numbers do you want to check:");
scanf("%d",&no_of_nos);
for(i=0;i<no_of_nos;i++)
{
printf("Enter number %d :",i+1);
scanf("%d",&num);
if(num>2)
{
for(j=2;j<=num/2;j++)
{
if(num%j==0)
{
count++;
break;
}
}
if(count==0)
{
printf("Entered number is prime no \n");
}
else
{
printf("Entered number is not a prime no \n");
}
}
else
{
printf("Entered number is not a prime no \n");
}
}
}