Eme C#
Eme C#
Eme C#
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace store_value_in_array
{
class Program
{
private static bool y;
//Assigning Value
for (i = 0; i < arrSize; i++)
{
Console.Write("Enter number: ");
arr[i] = Convert.ToInt32(Console.ReadLine());
}
Console.WriteLine("\n");
//Printing the value
for (i = 0; i < arrSize; i++)
{
Console.WriteLine("You Entered: {0}", arr[i]);
}
Console.WriteLine("\n");
//Get the sum of the elements
float sum = arr.Sum();
Console.WriteLine();
Console.WriteLine("Do you want to display all the informaation of your array? y or n");
Console.Write("----- ");
string ans = Console.ReadLine();
if (ans == "y")
{
float Newsum = arr.Sum();
//To roundoff
Console.WriteLine("RoundOff: " + Math.Round(Newaverage));
}
else
{
Console.WriteLine("THANK YOU FOR USING THE SYSTEM");
}
}
}
}