Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace _04CreditSystem
- {
- class Program
- {
- static void Main(string[] args)
- {
- var n = int.Parse(Console.ReadLine());
- double sum = 0;
- double credits = 0;
- for (int i = 0; i < n; i++)
- {
- var input = Console.ReadLine();
- char c = input.Last();
- int grade = int.Parse(c.ToString());
- sum += grade;
- var credit = double.Parse(input.TrimEnd(c));
- switch (grade)
- {
- case 2:
- credit = 0;
- break;
- case 3:
- credit = credit / 2;
- break;
- case 4:
- credit = credit * 0.7;
- break;
- case 5:
- credit = credit * 0.85;
- break;
- }
- credits += credit;
- }
- Console.WriteLine("{0:f2}", credits);
- Console.WriteLine("{0:f2}", sum / n);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement