Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- Console.WriteLine("Press 1 or 2 to select your choice");
- Console.WriteLine("1. Display all didigts from 9 to 0 using a for loop");
- Console.WriteLine("2. Display all didigts from 9 to 0 using a while loop");
- string choice = Console.ReadLine();
- if (choice == "1")
- {
- for (int i = 9; i >= 0; i--)
- {
- Console.WriteLine(i);
- }
- }
- else if (choice == "2")
- {
- int j = 9;
- while (j >= 0)
- {
- Console.WriteLine(j);
- j--;
- }
- }
- else
- return;
- Console.ReadKey();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement