Create a program that will allow the user to input a 3 digit number and program will then break the number into 3 separate values and display the difference from the first number from 9, the second number from 12 and the third number from 15.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Please, input a 3 digit number");
string num = Console.ReadLine();
int firstNum = Convert.ToInt32(num[0].ToString());
int secondNum = Convert.ToInt32(num[1].ToString());
int thirdNum = Convert.ToInt32(num[2].ToString());
Console.WriteLine($"9 - {firstNum} = {9 - firstNum}");
Console.WriteLine($"12 - {secondNum} = {12 - secondNum}");
Console.WriteLine($"15 - {thirdNum} = {15 - thirdNum}");
Console.ReadKey();
}
}
}
Comments
Leave a comment