Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Disclaimer: The creator of 'C# Shell (C# Offline Compiler)' is in no way responsible for the code posted by any user.
- using System;
- using System.IO;
- using System.Linq;
- using System.Collections.Generic;
- namespace Bonus_Scoring_System
- {
- public static class Program
- {
- public static void Main()
- {
- var students = int.Parse(Console.ReadLine());
- var lectures = int.Parse(Console.ReadLine());
- var bonus = int.Parse(Console.ReadLine());
- var attendances = new int[students];
- var totalBonuses= new double[attendances.Length];
- for(int i = 0;i<attendances.Length;i++)
- {
- attendances[i] = int.Parse(Console.ReadLine());
- totalBonuses[i] = (double)attendances[i] / lectures * (5 + bonus);
- }
- foreach(var item in totalBonuses)
- {
- Console.Write(Math.Round(item) + " ");
- }
- Console.WriteLine(" ");
- var studentAttendances = 0;
- var maxBonusPoints = 0.00;
- for(int j=0;j<totalBonuses.Length-1;j++)
- {
- for(int k=j+1;k<totalBonuses.Length;k++)
- {
- if(totalBonuses[j]>=totalBonuses[k] && maxBonusPoints < totalBonuses[j])
- {
- maxBonusPoints = totalBonuses[j];
- studentAttendances = attendances[j];
- }
- }
- }
- Console.WriteLine($"Max Bonus: {Math.Round(maxBonusPoints)}.");
- Console.WriteLine($"The student has attended {studentAttendances} lectures.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement