Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- //int prime (int n) nothing being returned (before)
- void prime (int n) //after, changed return type to void.
- {
- //int n, c = 2; removed the second 'n' declaration (before) since it is defined in the function signature.
- int c = 2; // (after)
- if ( n % c == 0 )
- {
- printf("%d is not prime.\n", n);
- }
- else
- {
- printf("%d is prime.\n", n);
- }
- }
- int main()
- {
- int n;
- printf("Please enter a number:\n");
- scanf("%d", &n);
- prime (n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement