Advertisement
Teodor92

DesendingOrder

Oct 30th, 2012
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.08 KB | None | 0 0
  1. using System;
  2.  
  3. class DesendingOrder
  4. {
  5.     static void Main()
  6.     {
  7.         int firstNum = 4;
  8.         int secondNum = 101;
  9.         int thirdNum = 100;
  10.         int temp;
  11.         if (secondNum > firstNum)
  12.         {
  13.             temp = firstNum;
  14.             firstNum = secondNum;
  15.             secondNum = temp;
  16.             if (thirdNum > secondNum)
  17.             {
  18.                 temp = thirdNum;
  19.                 thirdNum = secondNum;
  20.                 secondNum = temp;
  21.             }
  22.             if (secondNum > firstNum)
  23.             {
  24.                 temp = firstNum;
  25.                 firstNum = secondNum;
  26.                 secondNum = temp;
  27.             }
  28.         }
  29.         if (thirdNum > secondNum)
  30.         {
  31.             temp = thirdNum;
  32.             thirdNum = secondNum;
  33.             secondNum = temp;
  34.             if (secondNum > firstNum)
  35.             {
  36.                 temp = firstNum;
  37.                 firstNum = secondNum;
  38.                 secondNum = temp;
  39.             }
  40.         }
  41.         Console.WriteLine("{0}, {1}, {2}", firstNum, secondNum, thirdNum);
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement