Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class NotDivisible3And7All1ToNNumbers
- {
- static void Main ()
- {
- Console.Write("Please, enter a whole positive number for N = ");
- string numberStr = Console.ReadLine();
- int numberN = int.Parse(numberStr);
- if (numberN < 1)
- {
- Console.WriteLine("Error - Invalid Number !!!");
- }
- else
- {
- Console.Write("The all numbers from 1 to that number N, wich not divisible"
- + " by 3 and 7 at the same time, are: ");
- for (int i = 1; i <= numberN; i++)
- {
- if ((i % (3 * 7)) != 0)
- {
- Console.Write("{0} ", i);
- }
- }
- }
- Console.ReadLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement