Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Console.WriteLine("Enter name");
- string name = Console.ReadLine();
- char vote;
- int points = 0;
- for (int i = 1; i <= 200; i = i + 1)
- {
- vote = char.Parse(Console.ReadLine());
- if (vote == 'a')
- {
- points = points + 100;
- }
- if (vote == 'b')
- {
- points = points + 50;
- }
- if (vote == 'c')
- {
- points = points + 10;
- }
- else
- {
- points = points + 5;
- }
- }
- Console.WriteLine(name + points);
- // Solution 2
- Console.WriteLine("Enter name");
- string name = Console.ReadLine());
- char vote;
- int points = 0;
- for (int i = 1; i <= 200; i = i + 1)
- {
- vote = char.Parse(Console.ReadLine());
- switch (vote)
- {
- case 'a':
- points = points + 100;
- break;
- case 'b':
- points = points + 50;
- break;
- case 'c':
- points = points + 10;
- break;
- default:
- points = points + 5;
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement