Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Create a method GetMax() with two integer (int) parameters, that returns maximal of the two numbers.
- //Write a program that reads three numbers from the console and prints the biggest of them.
- //Use the GetMax() method you just created
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _29.Max_Method
- {
- class MaxMethod
- {
- static void Main(string[] args)
- {
- int firstNumber = int.Parse(Console.ReadLine());
- int secondNumber = int.Parse(Console.ReadLine());
- int thirdNumber = int.Parse(Console.ReadLine());
- int firstMax = GetMax(firstNumber, secondNumber);
- int max = GetMax(firstMax, thirdNumber);
- Console.WriteLine(max);
- }
- static int GetMax(int num1, int num2)
- {
- if (num1 > num2)
- {
- return num1;
- }
- return num2;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement