Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace NumsDivisibleBy349
- {
- class NumsDivisibleBy349
- {
- static void Main()
- {
- //user choosing some numbers
- Console.WriteLine("Enter a number for the lower limit of the interval: ");
- int lowL = 0;
- lowL = int.Parse(Console.ReadLine());
- Console.WriteLine("Enter a number for the upper limit of the interval: ");
- int upL = 0;
- upL = int.Parse(Console.ReadLine());
- Console.WriteLine("Enter a number for divisor (choose between 3,4 and 9): ");
- int divisor = 0;
- divisor = int.Parse(Console.ReadLine());
- //switch block for choosing the divisor
- switch (divisor)
- {
- case 3:
- divisor = 3;
- break;
- case 4:
- divisor = 4;
- break;
- default:
- divisor = 9;
- break;
- }
- //console output
- for (int i = lowL; i < upL; i++)
- {
- if (i % divisor == 0)
- {
- Console.WriteLine("The numbers divided by " + divisor + " without residue are: " + i);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement