Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace maxNumberWithForLoop
- {
- class MainClass
- {
- public static void Main(string[] args)
- {
- int[] numbers = Console.ReadLine().Split().Select(int.Parse).ToArray();
- int number = 0;
- int maxNumber = 0;
- for (int i = 0; i <= numbers.Length-1; i++)
- {
- for (int k = i; k <= numbers.Length-1; k++)
- {
- if (numbers[i] >= numbers[k])
- {
- number = numbers[i];
- if (number > maxNumber)
- {
- maxNumber = number;
- }
- }
- }
- }
- Console.WriteLine(maxNumber);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement