Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int plays=int.Parse(Console.ReadLine());
- double point = 0;
- double toTenPercentsAmount = 0;
- double toTwentyPercents = 0;
- double totwetyNine = 0;
- double toThirtyNicePecn = 0;
- double tofifty = 0;
- double toHundered = 0;
- double invalidNum = 0;
- for (int i = 0; i < plays; i++)
- {
- int pointsScored=int.Parse((Console.ReadLine()));
- if (pointsScored >= 0 && pointsScored <= 9)
- {
- point += pointsScored * 0.2;
- toTenPercentsAmount++;
- }
- else if (pointsScored >= 10 && pointsScored <= 19)
- {
- point += pointsScored * 0.3;
- toTwentyPercents++;
- }
- else if (pointsScored >= 20 && pointsScored <= 29)
- {
- point += pointsScored * 0.4;
- totwetyNine++;
- }
- else if (pointsScored >= 30 && pointsScored <= 39)
- {
- point += 50;
- toThirtyNicePecn++;
- }
- else if (pointsScored >= 40 && pointsScored <= 50)
- {
- point += 100;
- toHundered++;
- }
- else
- {
- invalidNum++;
- point /= 2;
- }
- }
- double toTenPercents = (double)toTenPercentsAmount / plays * 100;
- double tonineteen=(double)toTwentyPercents / plays * 100;
- double twentyNine=(double)totwetyNine / plays * 100;
- double thirtynine=(double)toThirtyNicePecn / plays * 100;
- double toHundredPercents = (double)toHundered / plays * 100;
- double invalidPercents = (double)invalidNum / plays * 100;
- Console.WriteLine($"{point:f2}");
- Console.WriteLine($"From 0 to 9: {toTenPercents:F2}%");
- Console.WriteLine($"From 10 to 19: {tonineteen:f2}%");
- Console.WriteLine($"From 20 to 29: {twentyNine:f2}%");
- Console.WriteLine($"From 30 to 39: {thirtynine:f2}%");
- Console.WriteLine($"From 40 to 50: {toHundredPercents:f2}%");
- Console.WriteLine($"Invalid numbers: {invalidPercents:F2}%");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement