Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- //Create a program to display on the screen the odd numbers from n to m (downwards),
- class DescendingOddNumbers
- {
- static void Main()
- {
- Console.Write("Start from: ");
- int n = int.Parse(Console.ReadLine());
- Console.Write("To: ");
- int m = int.Parse(Console.ReadLine());
- while ((n>=m))
- {
- if ((n % 2) != 0)
- {
- Console.WriteLine("{0}", n);
- n -= 2;
- }
- else
- {
- Console.WriteLine(n-1);
- n --;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement