daily pastebin goal
61%
SHARE
TWEET

Targil

Uriel133 Mar 20th, 2019 (edited) 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Console.WriteLine("Enter name");
  2. string name = Console.ReadLine();
  3. char vote;
  4. int points = 0;
  5. for (int i = 1; i <= 200; i = i + 1)
  6. {
  7. vote = char.Parse(Console.ReadLine());
  8. if (vote == 'a')
  9. {
  10. points = points + 100;
  11. }
  12. if (vote == 'b')
  13. {
  14. points = points + 50;
  15. }
  16. if (vote == 'c')
  17. {
  18. points = points + 10;
  19. }
  20. else
  21. {
  22. points = points + 5;
  23. }
  24. }
  25. Console.WriteLine(name + points);
  26.  
  27. // Solution 2
  28. Console.WriteLine("Enter name");
  29. string name = Console.ReadLine());
  30. char vote;
  31. int points = 0;
  32. for (int i = 1; i <= 200; i = i + 1)
  33. {
  34. vote = char.Parse(Console.ReadLine());
  35. switch (vote)
  36. {
  37. case 'a':
  38. points = points + 100;
  39. break;
  40. case 'b':
  41. points = points + 50;
  42. break;
  43. case 'c':
  44. points = points + 10;
  45. break;
  46. default:
  47. points = points + 5;
  48. break;
  49. }
  50. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top