Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ExamPreparation
- {
- class Startup
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- long result = 0;
- while (input != "END")
- {
- string[] tokens = input.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
- switch (tokens[0])
- {
- case "INC":
- long incOperand = long.Parse(tokens[1]);
- result = ++incOperand;
- break;
- case "DEC":
- long decOperand = long.Parse(tokens[1]);
- result = --decOperand;
- break;
- case "ADD":
- long first = long.Parse(tokens[1]);
- long second = long.Parse(tokens[2]);
- result = (first + second);
- break;
- case "MLA":
- long firstNum = long.Parse(tokens[1]);
- long secondNum = long.Parse(tokens[2]);
- result = (firstNum * secondNum);
- break;
- }
- Console.WriteLine(result);
- input = Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement