Advertisement
fannyxmikasa

Untitled

Nov 4th, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.84 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication2
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {  
  13.             string grade;
  14.             int totalGrade = 0, i = 0;
  15.             float average = 0;
  16.  
  17.             for ( ;i < 5; )
  18.             {
  19.                 Console.Write("Enter grade #{0}: ", i += 1);
  20.                 grade = Console.ReadLine();
  21.                 totalGrade += Convert.ToInt32(grade);
  22.             }
  23.             average = totalGrade / 5.0f;
  24.             if(average < 75)
  25.                 Console.WriteLine("\nTotal average is: "+ average +"\t\t\tRemarks: Failed");
  26.             else
  27.                 Console.WriteLine("\nTotal average is: {0}\t\t\tRemarks: Passed", average);
  28.         }
  29.     }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement