Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- //Write an if-statement that takes two doubleeger variables a and b and exchanges their values if the first one is greater than the second one. As a result prdouble the values a and b, separated by a space.
- class ExchangeIfGreater
- {
- static void Main(string[] args)
- {
- Console.Write("Enter an doubleeger number: ");
- double a = double.Parse(Console.ReadLine());
- Console.Write("Enter a second doubleeger number: ");
- double b = double.Parse(Console.ReadLine());
- bool aGreaterB = a > b;
- if (aGreaterB)
- {
- Console.WriteLine(b +" "+ a);
- }
- else
- Console.WriteLine(a+" "+b);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment