• 1.7k
• 381
• 8.1k

# c# console problem

Oct 12 2021 8:32 AM

The output should be like this;

Enter Student Name:     ahmet taha

Total Average : 90
Passed

The highest Score is : 95

The lowest Score is : 86

here is my code:

``````double avg;
Console.Write("Enter Student Name:\t");
avg = (math + science + english) / 3;
Console.Write("\nTotal Average : {0}", avg);
if( avg >= 75)
{
Console.Write("\nPassed");
}
else
{
Console.Write("\n");
Console.Write("Failed");

}

int[] arr1 = new int[math];
int[] arr2 = new int[science];
int[] arr3 = new int[english];
// int[] arr1 = new int[[math] || [science] || [english]];
//int[] arr1 = new int[science];
int[] arr1 = new int[english];
int mx, mn;
mx = arr1[0];
mn = arr1[0];
for (int x = 1; x < arr1.Length; x++)
{
//if (arr1[x] > mx || arr2[x] > mx || arr3[x] > mx)
if (arr1[x] > mx)
{
mx = arr1[x];
//mx = arr2[x];
//mx = arr3[x];
}
//if (arr1[x] < mn || arr2[x] < mn || arr3[x] < mn)
if (arr1[x] < mn)
{
mn = arr1[x];
//mn = arr2[x];
//mn = arr3[x];
}
}
Console.Write("\nThe Highest Grade is : {0} ", mx);
Console.Write("\nThe Lowest Grade is : {0} ", mn);``````