How to Input any Number in C#
Object:
How to Input any Number in c#, Input, and output in C#. C# Projects with Source Code
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Class_02
{
class Program
{
static void Main(string[] args)
{
int num1,num2,sum;
Console.WriteLine(“Enter Number 01 : “);
num1 = Convert.ToInt32( Console.ReadLine());
Console.WriteLine(“Enter Number 02 : “);
num2 = Convert.ToInt32(Console.ReadLine());
sum = num1 + num2;
Console.WriteLine(“Your Name is: {0}”, sum);
Console.ReadKey();
}
}
}
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Class_02 { class Program { static void Main(string[] args) { int num1,num2,sum; Console.WriteLine("Enter Number 01 : "); num1 = Convert.ToInt32( Console.ReadLine()); Console.WriteLine("Enter Number 02 : "); num2 = Convert.ToInt32(Console.ReadLine()); sum = num1 + num2; Console.WriteLine("Your Name is: {0}", sum); Console.ReadKey(); } } }
Output:
Another Program: C# Program that Subtracts two user-defined numbers
C++ projects for beginners with source code
Pingback: C# program which checks whether the number you inputted is an Even or Odd number
Pingback: Top 20 C# programs examples in 2021