Hello Guyz, need your help
The output should be like this;
Enter Student Name: ahmet taha
Enter Math Grade: 90
Enter Science Grade: 86
Enter English Grade : 95
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");
string name = Console.ReadLine();
Console.Write("Enter Math Grade:\t");
int math = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter Science Grade:\t");
int science = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter English Grade :\t");
int english = Convert.ToInt32(Console.ReadLine());
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);