Advertisement
soxa

FindTheBiggest

Nov 16th, 2013
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1. using System;
  2. // Write a program that finds the biggest of three integers using nested if statements.
  3.  
  4. class FindTheBiggest
  5. {
  6.     static void Main(string[] args)
  7.     {
  8.         int firstNum = int.Parse(Console.ReadLine());
  9.         int secNum = int.Parse(Console.ReadLine());
  10.         int thirdNum = int.Parse(Console.ReadLine());
  11.         int biggest = secNum;
  12.  
  13.         if (firstNum > secNum)
  14.         {
  15.             biggest = firstNum;
  16.         }
  17.         if (thirdNum > biggest)
  18.         {
  19.             biggest = thirdNum;
  20.         }
  21.         Console.WriteLine(biggest);
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement