Advertisement
Guest User

Untitled

a guest
Aug 29th, 2015
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.09 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7.  
  8. namespace Decisions
  9. {
  10.     class Program
  11.     {
  12.         static void Main()
  13.         {
  14.             Console.WriteLine("Enter the secret password:");
  15.             var password = Console.ReadLine();
  16.  
  17.             if (password.ToString() == "pie")
  18.             {
  19.                 Echo("How many times do you want to loop?");
  20.             }
  21.             else
  22.             {
  23.                Main();
  24.             }
  25.         }
  26.  
  27.         private static void Echo( string Error)
  28.         {
  29.             Console.WriteLine(Error);
  30.             var loopNumber = Console.ReadLine();
  31.             int Value;
  32.             if (int.TryParse(loopNumber, out Value))
  33.             {
  34.                 for (int i = 0; i <= Value; i++)
  35.                 {
  36.                     Console.WriteLine("Test");
  37.                 }
  38.                 Echo("How many times do you want to loop?");
  39.             } else
  40.             {
  41.                 Echo("Please type in a number.");
  42.             }
  43.  
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement