-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIfPrimeOrNot.c
More file actions
63 lines (57 loc) · 1.09 KB
/
IfPrimeOrNot.c
File metadata and controls
63 lines (57 loc) · 1.09 KB
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
/*
* =====================================================================================
*
* Filename: IfPrimeOrNot.c
*
* Description:
*
* Version: 1.0
* Created: 20-Oct-21 14:56:51
* Revision: none
* Compiler: gcc
*
* Author: Jwtiyar Nariman (), jwtiyar@gmail.com
* Organization:
*
* =====================================================================================
*/
//#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <math.h>
int main()
{
int input;
scanf("%d", &input);
for (int i=sqrt(input); i > 1;i--)
{
if (input % 2 == 0)
{
printf("%d Not prime\n",input);
}else
{
printf("%d is prime\n",input);
}
}
return 0;
}
/* int main() */
/* { */
/* int input=9; */
/* int isPrime=true; */
/* for(int i = sqrt(input);i > 1; i--) */
/* { */
/* printf("%d ",i); */
/* if(input % i == 0) */
/* { */
/* isPrime=false; */
/* } */
/* } */
/* if (isPrime) */
/* { */
/* printf("\nis prime\n"); */
/* }else */
/* { */
/* printf("\nNot prime\n"); */
/* } */
/* } */