is prime number
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #include <stdio.h> int Is_Prime_Number (int number); int main (int argc, char** argv) { int Positive_Integer = 100; int loop = 0; for (loop = 2; loop < Positive_Integer + 1; loop++) { int Prime_Number = Is_Prime_Number (loop); if (Prime_Number == 0) continue; int Next_Prime_Number = Positive_Integer - Prime_Number; if (Is_Prime_Number (Next_Prime_Number) == 0) continue; if (Prime_Number > Next_Prime_Number) break; printf ("%d = %d + %d\n", Positive_Integer, Prime_Number, Next_Prime_Number); } return 0; } int Is_Prime_Number (int number) { int loop = 0; for (loop = 2; loop <= number / 2; loop++) { if (number % loop == 0) return 0; } return number; } | cs |
0 개의 댓글:
댓글 쓰기