107 311
Assignments Done
98.9%
Successfully Done
In March 2023

# Answer to Question #267185 in C# for rizvi

Question #267185

The manager of the company has informed his assistant to enter the age

of all the workers working in production department. Among all he has to

find the employee with maximum age employee. Help the manager to

find the maximum age employee by storing the all age of all employee in

1D array dynamically. Use functions to solve the task.

Input Format

19 21 22 23 18

Constraints

All numbers should be greater than 0.If constraints are not matched then

display "wrong input"

Output Format

23

1
2021-11-16T13:50:28-0500
using System;
using System.Collections.Generic;

namespace App
{
class Program
{

static void Main(string[] args)
{
Console.Write("Enter numbers: ");
int maxValue = int.Parse(values[0]);

for (int i = 0; i < values.Length; i++)
{
int number = int.Parse(values[i]);
if (number < 0)
{

maxValue = -1;
break;
}
else {
if (number > maxValue)
{
maxValue = number;
}
}

}
if (maxValue != -1)
{
Console.WriteLine("Max number is: {0}", maxValue);
}
else {
Console.WriteLine("wrong input");
}

}
}
}



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!