Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- namespace ConsoleApp1
- {
- class Exam
- {
- static void Main(string[] args)
- {
- // { total bonus} = { student attendances} / { course lectures} * (5 + { additional bonus})
- double students = double.Parse(Console.ReadLine());
- double lectures = double.Parse(Console.ReadLine());
- double bonus = double.Parse(Console.ReadLine());
- double totalBonus = 0;
- double maxBonus = 0;
- double maxAttendance = 0;
- for (int i = 0; i < students; i++)
- {
- double attendance = double.Parse(Console.ReadLine());
- totalBonus = attendance / lectures * (5 + bonus);
- if (totalBonus > maxBonus)
- {
- maxBonus = totalBonus;
- maxAttendance = attendance;
- }
- }
- Console.WriteLine($"Max Bonus: {Math.Round(maxBonus)}.");
- Console.WriteLine($"The student has attended {maxAttendance} lectures.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement