Advertisement
Alexander_B

Graduation

Feb 9th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 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 DomashnoGraduation
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int numberOfInputs = 1;
  14. double gradeAcumulate = 0.00;
  15.  
  16. string name = Console.ReadLine();
  17.  
  18. while (numberOfInputs <= 12)
  19. {
  20. double grade = double.Parse(Console.ReadLine());
  21. if (grade >= 4.00)
  22. {
  23. gradeAcumulate += grade;
  24. numberOfInputs++;
  25. }
  26. }
  27.  
  28. double averageGrade = 1.00 * gradeAcumulate / (numberOfInputs-1);
  29. Console.WriteLine($"{name} graduated. Average grade: {averageGrade:f2}");
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement