We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ba0ba69 commit ec4c4a5Copy full SHA for ec4c4a5
_2b.prime.c
@@ -0,0 +1,30 @@
1
+#include<stdio.h>
2
+int main()
3
+{
4
+int i,n,flag;
5
+printf("enter the number");
6
+scanf("%d",&n);
7
+if(n==1)
8
+ {
9
+ printf("It is neither prime nor composite");
10
+ }
11
+else
12
+flag=0;
13
+for (i=2;i<=n/2;i++)
14
15
+ if (n%i ==0)
16
17
+ flag=1;
18
+ break;
19
20
+}
21
+ if(flag==0 && n!=1)
22
23
+ printf(" It is prime");
24
25
26
+{ if (flag==1 && n!=1)
27
+ printf("It is not prime");
28
29
+return 0;
30
0 commit comments