Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _02
- {
- class Program
- {
- static void Main(string[] args)
- {
- int count = int.Parse(Console.ReadLine());
- int countLight = 0;
- int countModerate = 0;
- int countStrong = 0;
- int countVeryStrong = 0;
- for (int earthquake = 1; earthquake <= count; earthquake++)
- {
- double rihterScale = double.Parse(Console.ReadLine());
- if (rihterScale >= 0 && rihterScale <= 4)
- {
- countLight++;
- }
- else if (rihterScale > 4 && rihterScale <= 6)
- {
- countModerate++;
- }
- else if (rihterScale > 6 && rihterScale <= 7)
- {
- countStrong++;
- }
- else if (rihterScale > 7)
- {
- countVeryStrong++;
- }
- }
- double percentLight = countLight * 1.0 / count * 100;
- double percentModerate = countModerate * 1.0 / count * 100;
- double percentStrong = countStrong * 1.0 / count * 100;
- double percentVeryStrong = countVeryStrong * 1.0 / count * 100;
- Console.WriteLine($"Light: {percentLight:F2}%");
- Console.WriteLine($"Moderate: {percentModerate:F2}%");
- Console.WriteLine($"Strong: {percentStrong:F2}%");
- Console.WriteLine($"Very Strong: {percentVeryStrong:F2}%");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment