Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. int n = int.Parse(Console.ReadLine());
  2. int points = 0;
  3.  
  4. int pointred = 0;
  5. int pointorange = 0;
  6. int pointyellow = 0;
  7. int pointwhite = 0;
  8. int pointblack = 0;
  9. int othercolors = 0;
  10.  
  11.  
  12. for (int i = 0; i < n; i++)
  13. {
  14. string color = Console.ReadLine();
  15. if(color == "red")
  16. {
  17. points = points + 5;
  18. pointred++;
  19. }
  20. else if (color == "orange")
  21. {
  22. points = points + 10;
  23. pointorange++;
  24. }
  25. else if (color == "yellow")
  26. {
  27. points = points + 15;
  28. pointyellow++;
  29. }
  30. else if (color == "white")
  31. {
  32. points = points + 20;
  33. pointwhite++;
  34. }
  35. else if (color == "black")
  36. {
  37. points = points/2;
  38. pointblack++;
  39. }
  40. else
  41. {
  42. Console.WriteLine();
  43. othercolors++;
  44.  
  45. }
  46.  
  47. }
  48.  
  49. Console.WriteLine($"Total points: {points}");
  50. Console.WriteLine($"Points from red balls: {pointred}");
  51. Console.WriteLine($"Points from orange balls: {pointorange}");
  52. Console.WriteLine($"Points from yellow balls: {pointyellow}");
  53. Console.WriteLine($"Points from white balls: {pointwhite}");
  54. Console.WriteLine($"Other colors picked: {othercolors}");
  55. Console.WriteLine($"Divides from black balls: {pointblack}");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement