Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int is_prime(int x)
- {
- int i,c = 0;
- for (i = 1; i <= x; i++)
- {
- if (x % i == 0)
- {
- c++;
- }
- }
- if (c == 2) {
- printf("%d is a Prime number.",x);
- }
- else {
- printf("%d is not a Prime number.",x);
- }
- }
- int main()
- {
- int x;
- printf("Wirite number: ");
- scanf("\n%d",&x);
- is_prime(x);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement