Advertisement
2629881

Untitled

Jul 22nd, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. static void Main(string[] args)
  2.         {
  3.            
  4.             Console.WriteLine("Press 1 or 2 to select your choice");
  5.             Console.WriteLine("1. Display all didigts from 9 to 0 using a for loop");
  6.             Console.WriteLine("2. Display all didigts from 9 to 0 using a while loop");
  7.             string choice = Console.ReadLine();
  8.  
  9.             if (choice == "1")
  10.             {
  11.                 for (int i = 9; i >= 0; i--)
  12.                 {
  13.                     Console.WriteLine(i);
  14.                 }
  15.             }
  16.             else if (choice == "2")
  17.             {
  18.                 int j = 9;
  19.                 while (j >= 0)
  20.                 {
  21.                     Console.WriteLine(j);
  22.                     j--;
  23.                 }
  24.             }
  25.             else
  26.                 return;
  27.                
  28.  
  29.             Console.ReadKey();
  30.              
  31.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement