Advertisement
svetoslavbozov

[C#-1.6.2] CantDevideBy3or7

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