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("x is a Prime number");
- }
- else {
- printf("x is not a Prime number");
- }
- }
- 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