desislava777

histogram

Dec 12th, 2017
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication1
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int n = int.Parse(Console.ReadLine());
  14. double broy = 0;
  15. double broy1 = 0;
  16. double broy2 = 0;
  17. double broy3 = 0;
  18. double broy4 = 0;
  19. double broy5 = 0;
  20. for (int i = 1; i <= n; i++)
  21. {
  22. int num = int.Parse(Console.ReadLine());
  23. broy++;
  24. if (num < 200) broy1++;
  25. if (num >= 200 && num < 400) broy2++;
  26. if (num >= 400 && num < 600) broy3++;
  27. if (num >= 600 && num < 800) broy4++;
  28. if (num >= 800) broy5++;
  29. }
  30. Console.WriteLine("{0:0.00}%", 100 * broy1 / broy);
  31. Console.WriteLine("{0:0.00}%", 100 * broy2 / broy);
  32. Console.WriteLine("{0:0.00}%", 100 * broy3 / broy);
  33. Console.WriteLine("{0:0.00}%", 100 * broy4 / broy);
  34. Console.WriteLine("{0:0.00}%", 100 * broy5 / broy);
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment