Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace BonusScoringSystem
- {
- class MainClass
- {
- public static void Main(string[] args)
- {
- int studentsCount = int.Parse(Console.ReadLine());
- int lecturesCount = int.Parse(Console.ReadLine());
- int additinalBonus = int.Parse(Console.ReadLine());
- double totalBonus = 0;
- double maxTotalBonus = 0;
- int maxStudentAttendances = 0;
- for (int i = 0; i < studentsCount; i++)
- {
- int studentAttendances = int.Parse(Console.ReadLine());
- totalBonus =(double) studentAttendances / lecturesCount * (5 + additinalBonus);
- if (totalBonus > maxTotalBonus)
- {
- maxTotalBonus = totalBonus;
- maxStudentAttendances = studentAttendances;
- }
- }
- Console.WriteLine($"Max Bonus: {(int)Math.Round((double)maxTotalBonus,MidpointRounding.AwayFromZero)}.");
- Console.WriteLine($"The student has attended {maxStudentAttendances} lectures.");
- }
- }
- }
Add Comment
Please, Sign In to add comment