Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace TestExcercises
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] input;
- string command;
- long firstOperand;
- while (true)
- {
- input = Console.ReadLine().Split();
- command = input[0];
- if (command == "END")
- {
- break;
- }
- firstOperand = long.Parse(input[1]);
- switch (command)
- {
- case "INC":
- {
- Console.WriteLine(IncrementNumber(firstOperand));
- break;
- }
- case "DEC":
- {
- Console.WriteLine(DecrementNumber(firstOperand));
- break;
- }
- case "ADD":
- {
- long secondOperand = long.Parse(input[2]);
- Console.WriteLine(AddNumbers(firstOperand, secondOperand));
- break;
- }
- case "MLA":
- {
- long secondOperand = long.Parse(input[2]);
- Console.WriteLine(MultiplycationNumbers(firstOperand, secondOperand));
- break;
- }
- case "END":
- {
- break;
- }
- }
- }
- }
- private static long IncrementNumber(long firstOperand)
- {
- long result = firstOperand + 1;
- return result;
- }
- private static long DecrementNumber(long firstOperand)
- {
- long result = firstOperand - 1;
- return result;
- }
- private static long MultiplycationNumbers(long firstOperand, long secondOperand)
- {
- long result = (long)firstOperand * (long)secondOperand;
- return result;
- }
- private static long AddNumbers(long firstOperand, long secondOperand)
- {
- long result = firstOperand + secondOperand;
- return result;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement