kirililchev3

IntervalOfNumbers - min max and for loop

May 20th, 2018
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | None | 0 0
  1. using System;
  2.  
  3. namespace P06IntervalOfNumbers
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int num1 = int.Parse(Console.ReadLine());
  10.             int num2 = int.Parse(Console.ReadLine());
  11.             int max = 0;
  12.             int min = 0;
  13.  
  14.             if (num1 >= num2)
  15.             {
  16.                 max = num1;
  17.                 min = num2;
  18.             } else
  19.             {
  20.                 max = num2;
  21.                 min = num1;
  22.             }
  23.  
  24.             for (int i = min; i <= max; i++)
  25.             {
  26.                
  27.                 Console.WriteLine(i);
  28.             }
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment