63 749
Assignments Done
99,4%
Successfully Done
In August 2018

Answer to Question #42768 in C# for priya

Question #42768

Sam is working on an application wherein he needs to accept the size of a one dimensional array
and its values. He needs to identify the largest and smallest number in the array and based on that
he needs to display the result. Help him to create the application
Expert's answer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _42768
{
class Program
{
  static void Main(string[] args)
  {
int size;//array size
Console.Write("Array size: ");
size = Convert.ToInt32(Console.ReadLine());
double[] arr = new double[size];//array
//reading array from keyboard
for(int i = 0; i < size; i++)
{
Console.Write("Array element #" + (i+1) + ": ");
arr[i] = Convert.ToDouble(Console.ReadLine());
}
//max and min
Console.WriteLine("Max = " + arr.Max());
Console.WriteLine("Min = " + arr.Min());
  }
}
}

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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions