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 _06FourDigitNumber
- {
- class FourDigitNumber
- {
- static void Main()
- {
- Console.Write("Enter a four-digit number: ");
- int a = Console.Read() - '0';
- int b = Console.Read() - '0';
- int c = Console.Read() - '0';
- int d = Console.Read() - '0';
- Console.WriteLine("Sum of numbers: {0}", a + b + c + d);
- Console.WriteLine("Reversed order: {0}{1}{2}{3}", d, c, b, a);
- Console.WriteLine("Last digit in front: {0}{1}{2}{3}", d, a, b, c);
- Console.WriteLine("Second and third digit exchanged: {0}{1}{2}{3}", a, c, b, d);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement