Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int isPrime(int x)
- {
- int c = 0;
- if (x == 0 || x == 1)
- return 0;
- for (int i = 2; i < x; i++)
- {
- if (x % i == 0)
- c++;
- }
- if (c == 0)
- return 1;
- else
- return 0;
- }
- void main()
- {
- printf("PRIME NUMBERS LESS THAN 100 ARE : \n");
- for (int i = 0; i < 100; i++)
- {
- if (isPrime(i) == 1)
- printf("%d\n", i);
- }
- }
Add Comment
Please, Sign In to add comment