Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace prime
- {
- class MainClass
- {
- public static void Main (string[] args)
- {
- int a;
- int n;
- int.TryParse(Console.ReadLine(), out n);
- Console.WriteLine ("The prime numbers in the range from 0 to " + n + " are: ");
- for (a = 2; a <= n; a++)
- {
- bool res1 = ((a % 2) == 0);
- bool res2 = ((a % 3) == 0);
- bool res3 = ((a % 5) == 0);
- bool res4 = ((a % 7) == 0);
- if (!res1 && !res2 && !res3 && !res4)
- {
- Console.WriteLine (a);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement