Advertisement
Teodor92

Bigger

Oct 30th, 2012
480
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. /* Write a program that finds the biggest
  2.  * of three integers using nested if statements.
  3.  */
  4.  
  5. using System;
  6.  
  7. class BiggestOfThree
  8. {  
  9.     static int IsBigger(int first, int second)
  10.     {
  11.        
  12.         if (first > second)
  13.         {
  14.             return first;
  15.         }
  16.         else
  17.         {
  18.             return second;
  19.         }
  20.     }
  21.     static void Main()
  22.     {
  23.         int firstNum = 3;
  24.         int secondNum = 5;
  25.         int thirdNum = 8;
  26.         int biggest = 0;
  27.         biggest = IsBigger(firstNum, secondNum);
  28.         biggest = IsBigger(biggest, thirdNum);
  29.         Console.WriteLine(biggest);
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement