Advertisement
Guest User

xo

a guest
Mar 22nd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 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 exam2018
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int balls = int.Parse(Console.ReadLine());
  14.  
  15. int score = 0;
  16. int red = 0;
  17. int orange = 0;
  18. int yellow = 0;
  19. int white = 0;
  20. int black = 0;
  21. int different = 0;
  22. int divides = 0;
  23. for (int i = 0; i < balls; i++)
  24. {
  25. string colour = Console.ReadLine();
  26.  
  27. if (colour == "red")
  28. {
  29. score += 5;
  30. red+=1;
  31. }else if (colour == "orange")
  32. {
  33. score += 10;
  34. orange+=1;
  35. }else if (colour == "yellow")
  36. {
  37. score += 15;
  38. yellow+=1;
  39. }else if (colour == "white")
  40. {
  41. score += 20;
  42. white+=1;
  43. }else if (colour == "black")
  44. {
  45. score /= 2;
  46. divides += 1;
  47.  
  48.  
  49.  
  50. }
  51. else
  52. {
  53. score += 0;
  54. different += 1 ;
  55. }
  56.  
  57.  
  58.  
  59. }
  60.  
  61. Console.WriteLine($"Total points: {score}");
  62. Console.WriteLine($"Points from red balls: {red}");
  63. Console.WriteLine($"Points from orange balls: {orange}");
  64. Console.WriteLine($"Points from yellow balls: {yellow}");
  65. Console.WriteLine($"Points from white balls: {white}");
  66. Console.WriteLine($"Other colors picked: {different}");
  67. Console.WriteLine($"Divides from black balls: {divides}");
  68.  
  69. }
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement