Advertisement
AlexeySudakov

Untitled

Aug 5th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. using System;
  2.  
  3. namespace light
  4. {
  5.     class MainClass
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             int userFloor = 5;
  10.             int ElevatorFloor = 10;
  11.  
  12.             if (ElevatorFloor>userFloor)
  13.             {
  14.                 for (int i = ElevatorFloor; i >= userFloor; i--)
  15.                 {
  16.                     Console.WriteLine(i + " Floor");
  17.                 }
  18.             }
  19.             else if (ElevatorFloor < userFloor)
  20.             {
  21.                 for (int i = ElevatorFloor; i <= userFloor; i++)
  22.                 {
  23.                     Console.WriteLine(i + " Floor");
  24.                 }
  25.             }
  26.             else
  27.                 Console.WriteLine("Lift arrived");
  28.                
  29.             Console.WriteLine("Lift arrived");
  30.  
  31.  
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement