nKolchakoV

Untitled

Nov 22nd, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.43 KB | None | 0 0
  1. using System;
  2. //Write a program that prints all the numbers from 1 to N,
  3. //that are not divisible by 3 and 7 at the same time.
  4.  
  5. class Program
  6. {
  7. static void Main()
  8. {
  9.     Console.Write("Enter a number n [n>1]: ");
  10.     int n = int.Parse(Console.ReadLine());
  11.  
  12.     for (int i = 1; i <= n; i++)
  13.     {
  14.         if ((i % 3 == 0) & (i % 7 == 0))
  15.         {
  16.             continue;
  17.         }
  18.         Console.WriteLine(i);
  19.     }
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment