This is a"how to" to get two different datas from user and define them to two different variables:
Download this code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | using System; namespace Variables { class Program { static void Main(string[] args) { starthere: Console.WriteLine("Please enter first number:"); int first = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Please enter second number which is greater then the first:"); int second = Convert.ToInt32(Console.ReadLine()); if (first < second) { Console.WriteLine("\nLet's count them from smaller to greater:\n"); for (int i = first; i <= second; i++) { Console.WriteLine(i); } } else { Console.WriteLine("\nThe first number ({0}) can not be greater then or equal to the second ({1})\n", first, second); goto starthere; } } } } |
Download this code.
Comments
Post a Comment