Advertisement
stamen4o

Numbers Not Divisible by 3 and 7

Mar 26th, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. using System;
  2. class NumsNotD3and7
  3. {
  4. static void Main()
  5. {
  6. Console.Title = "Numbers not divisible by 3 and 7";
  7. Console.Write("Enter number n: ");
  8. int n = int.Parse(Console.ReadLine());
  9. for (int i = 1; i <= n; i++)
  10. {
  11. if (i % 3 != 0 && i % 7 != 0)
  12. {
  13. Console.Write(i + " ");
  14. }
  15. }
  16. Console.WriteLine();
  17. Main();
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement