Untitled

mail@pastecode.io avatar
unknown
csharp
18 days ago
2.5 kB
6
Indexable
Never
using System;

namespace ClassProgram
{
  class Program
  {
    static void Main(string[] args)
    {
        // Inputs
        Console.WriteLine("Enter Student Name: ");
        string studentName = Console.ReadLine();
        
        Console.WriteLine("Enter Grade Level: ");
        int gradeLevel = Convert.ToInt32(Console.ReadLine());
        
        Console.WriteLine("Enter Section: ");
        string section = Console.ReadLine();
        
        Console.WriteLine("Enter Address: ");
        string address = Console.ReadLine();
        
        // Array of Subjects
        Console.WriteLine("Enter 5 Subjects the Student is Studying (Separated by Space): ");
        string subjects = Console.ReadLine();
        string[] subjectArray = subjects.Split(' ');
        
        Console.WriteLine("Enter grade for " + subjectArray[0] + ": ");
        int gradeOne = Convert.ToInt32(Console.ReadLine());
        Console.WriteLine("Enter grade for " + subjectArray[1] + ": ");
        int gradeTwo = Convert.ToInt32(Console.ReadLine());
        Console.WriteLine("Enter grade for " + subjectArray[2] + ": ");
        int gradeThree = Convert.ToInt32(Console.ReadLine());
        Console.WriteLine("Enter grade for " + subjectArray[4] + ": ");
        int gradeFour = Convert.ToInt32(Console.ReadLine());
        Console.WriteLine("Enter grade for " + subjectArray[4] + ": ");
        int gradeFive = Convert.ToInt32(Console.ReadLine());
        
        int average = (gradeOne + gradeTwo + gradeThree + gradeFour + gradeFive) / 5;
        
        // Printing of Outputs
        Console.WriteLine();
        Console.WriteLine();
        Console.WriteLine("Student Name: " + studentName);
        Console.WriteLine("Grade Level: " + gradeLevel);
        Console.WriteLine("Section: " + section);
        Console.WriteLine("Address: " + address);
        Console.WriteLine(subjectArray[0] + "Grade: " + gradeOne);
        Console.WriteLine(subjectArray[1] + "Grade: " + gradeTwo);
        Console.WriteLine(subjectArray[2] + "Grade: " + gradeThree);
        Console.WriteLine(subjectArray[3] + "Grade: " + gradeFour);
        Console.WriteLine(subjectArray[4] + "Grade: " + gradeFive);
        Console.WriteLine("AVERAGE: " + average);
        
        // Program Termination
        Console.WriteLine("Press Any Key to Exit...");
        Console.ReadKey(true);
        Console.WriteLine("K bye.")
    }
  }
}
Leave a Comment