Advertisement
coasterka

NumsDivisibleBy349

Mar 11th, 2014
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.33 KB | None | 0 0
  1. using System;
  2.  
  3. namespace NumsDivisibleBy349
  4. {
  5.     class NumsDivisibleBy349
  6.     {
  7.         static void Main()
  8.         {
  9.             //user choosing some numbers
  10.             Console.WriteLine("Enter a number for the lower limit of the interval: ");
  11.             int lowL = 0;
  12.             lowL = int.Parse(Console.ReadLine());
  13.             Console.WriteLine("Enter a number for the upper limit of the interval: ");
  14.             int upL = 0;
  15.             upL = int.Parse(Console.ReadLine());
  16.             Console.WriteLine("Enter a number for divisor (choose between 3,4 and 9): ");
  17.             int divisor = 0;
  18.             divisor = int.Parse(Console.ReadLine());
  19.             //switch block for choosing the divisor
  20.             switch (divisor)
  21.             {
  22.                 case 3:
  23.                     divisor = 3;
  24.                     break;
  25.                 case 4:
  26.                     divisor = 4;
  27.                     break;
  28.                 default:
  29.                     divisor = 9;
  30.                     break;
  31.             }
  32.             //console output
  33.             for (int i = lowL; i < upL; i++)
  34.             {
  35.                 if (i % divisor == 0)
  36.                 {
  37.                     Console.WriteLine("The numbers divided by " + divisor + " without residue are: " + i);
  38.                 }
  39.             }
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement