Advertisement
Fundamentalen

ExchangeIfGreater

Mar 20th, 2014
418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. using System;
  2.  
  3. class ExchangeIfGreater
  4. {
  5.     static void Main()
  6.     {
  7.         Console.Write("a = ");
  8.         double a = double.Parse(Console.ReadLine());
  9.         Console.Write("b = ");
  10.         double b = double.Parse(Console.ReadLine());
  11.  
  12.         double c;
  13.  
  14.         if (a > b)
  15.         {
  16.             c = a;
  17.             a = b;
  18.             b = c;
  19.  
  20.             Console.WriteLine("{0} {1}", a, b);
  21.         }
  22.         else
  23.         {
  24.             Console.WriteLine("{0} {1}", a, b);
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement