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 using math function.
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.
Program Listing
// grade_solver.cs
// Author : Mr. Jake Rodriguez Pomperada, MAED-IT, MIT
// www.jakerpomperada.com
// www.jakerpomperada.blogspot.com
// jakerpomperada@gmail.com
// Bacolod City, Negros Occidental, Philippines
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int average_grade = 0;
int total_grade = 0;
int[] grades = new int[4];
string[] subjects =
new string[] { "English", "Math", "Filipino", "Science"};
Console.WriteLine("\n");
Console.WriteLine("\tStudent Grade Solver in C#");
Console.WriteLine("\n");
for(int i =0 ; i<4; i++){
Console.Write("\tEnter Grade in " + subjects[i] + " : ");
grades[i] = int.Parse(Console.ReadLine());
total_grade += grades[i];
average_grade = (total_grade / 4);
}
int highest_grade = grades[0];
int lowest_grade = grades[0];
for(int i=0; i<4; i++){
if (grades[i] > highest_grade)
{
highest_grade = grades[i];
}
if(grades[i] < lowest_grade){
lowest_grade = grades[i];
}
}
Console.WriteLine("\n");
Console.WriteLine("\tAverage : {00}",average_grade);
Console.WriteLine("\tLowest Grade : {00}",lowest_grade);
Console.WriteLine("\tHighest Grade : {00}",highest_grade);
Console.WriteLine("\n");
Console.WriteLine("\tEnd of Program");
Console.WriteLine("\n\n");
Console.ReadKey();
}
}
}
No comments:
Post a Comment