-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathimpq7.c
73 lines (35 loc) · 870 Bytes
/
impq7.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include<stdio.h>
int main()
{
int ar[100],i,n,j,counter;
printf("Enter the size of the array ");
scanf("%d",&n);
printf("\n Now enter the elements of the array");
for(i=0;i<n;i++)
{
scanf("%d",&ar[i]);
}
printf(" Array is -");
for(i=0;i<n;i++)
{
printf("\t %d",ar[i]);
}
printf("\n All the prime numbers in the array are -");
for(i=0;i<n;i++)
{
counter=0;
for(j=2;j<ar[i]/2;j++)
{
if(ar[i]%j==0)
{
counter=1;
break;
}
}
if(counter==0 && n!=1)
{
printf("\t %d",ar[i]);
}
}
return 0;
}