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;
- class Program
- {
- static void Main()
- {
- string input;
- int number;
- input = Console.ReadLine();
- if (!int.TryParse(input, out number) || number < 1000 || number > 9999)
- {
- Console.WriteLine("wrong");
- }
- else {
- int digit_1 = number / 1000;
- int digit_2 = (number / 100) % 10;
- int digit_3 = (number % 100) / 10;
- int digit_4 = number % 10;
- int result = (10 * digit_1 + digit_2) - (10 * digit_4 + digit_3) + 1;
- Console.WriteLine(result);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement