Machine Problem
Write a C# program that will input your grades in different subjects last year
and display the average grade, highest grade and lowest grade.
Sample Output:
Enter grade in English: 89
Enter grade in Math: 91
Enter grade in Filipino: 92
Enter grade in Science: 88
Average: 90
Lowest Grade: 88
Highest Grade:92
I
am currently accepting programming work, IT projects, school and
application development, programming projects, thesis and capstone
projects, IT consulting work, computer tutorials, and web development
work kindly contact me at the following email address for further
details. If you want to advertise on my website kindly contact me also
in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Please subscribe to my channel https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg
=================================================
Want to support my channel?
GCash Account
Jake Pomperada
09173084360
Paypal
https://paypal.me/jakerpomperada
Patreon
https://www.patreon.com/jakerpomperada
Thank you very much for your support.
Program Listing
using System;
/* average.cs
Author : Jake Rodriguez Pomperada, MAED-IT, MIT
Tools : C#
Date : September 27, 2022 Tuesday 3:58 PM
Website : www.jakerpomperada.com
Email : jakerpomperada@gmail.com
*/
public class average
{
public static void Main()
{
int[] arr = new int[4];
int i=0;
int average = 0;
int total_grades = 0;
Console.Write("\n\n");
Console.Write("\t---------------------------------------------------------");
Console.Write("\n\tAverage Grade, Highest Grade and Lowest Grade in C#\n");
Console.Write("\t---------------------------------------------------------\n\n");
string[] subjects = new string[4];
subjects[0] = "English";
subjects[1] = "Math";
subjects[2] = "Filipino";
subjects[3] = "Science";
for (i = 0; i < arr.Length; i++)
{
string element = subjects[i];
Console.Write("\tEnter Grade in {0} : ",element);
arr[i] = Convert.ToInt32(Console.ReadLine());
total_grades+= arr[i];
average = total_grades/4;
}
int Highest_Grade = arr[0];
int Lowest_Grade = arr[0];
for(i=0; i<4; i++)
{
if(arr[i]> Highest_Grade)
{
Highest_Grade = arr[i];
}
if(arr[i]<Lowest_Grade)
{
Lowest_Grade = arr[i];
}
}
Console.Write("\n");
Console.Write("\tAverage : {0} \n",average);
Console.Write("\tLowest Grade : {0} \n",Lowest_Grade);
Console.Write("\tHighest Grade : {0} \n",Highest_Grade);
Console.Write("\n");
Console.Write("\tEnd of Program");
Console.Write("\n");
}
}
No comments:
Post a Comment