this is my code:
Code:#include <stdio.h> #include <stdlib.h> #include<math.h> int main (void) { int n; FILE * input; input = fopen("input.txt", "r"); fscanf(input, "%d", &n); if(n == 2) printf("%d is prime", n); else if(n % 2 == 0 || n < 2) printf("no, %d is prime!", &n); else { int x; for(x = 0; x < (int)sqrt((double)n); x++) if(n % x == 0) { printf("no, %d is not prime", &n); return; } printf("yes, %d is prime!", &n); } if(n % 7 == 0) printf("Yes, %d is a multiple of 7",&n); if(n % 11 == 0) printf("Yes, %d is a multiple of 11",&n); if(n % 13 == 0) printf("Yes, %d is a multiple of 13",&n); else printf("No, %d is not a multiple of 7, 11, or 13",&n); if(n % 2 == 0) printf("%d is even", &n); else printf("%d is odd", &n); fclose(input); return 0; }
Let me know what you think thanks![]()



LinkBack URL
About LinkBacks



