C & C++ PROGRAMMING
2.84K subscribers
91 photos
1 video
42 files
55 links
https://t.me/addlist/oJIs6WVKrqBmMWQ1

Hello! I am @Myhurthearts and welcome to the Coding channel! Here we can learn all things related to coding and improve our skills , just let me know
Download Telegram
Program to add two numbers
-------------------------------------------------
Program:


using System;

class Program
{
static void Main()
{
double number1, number2, sum;

Console.WriteLine("Enter the first number: ");
number1 = Convert.ToDouble(Console.ReadLine());

Console.WriteLine("Enter the second number: ");
number2 = Convert.ToDouble(Console.ReadLine());

sum = number1 + number2;

Console.WriteLine("The sum of {0} and {1} is: {2}", number1, number2, sum);
}
}

-------------------------------------------------
#basicprograms
Program to add two numbers by accepting input from the user:
----------------------------------------------------
Program:

using System;

class MainClass {
public static void Main (string[] args) {
Console.WriteLine("Enter the first number:");
int num1 = Convert.ToInt32(Console.ReadLine());

Console.WriteLine("Enter the second number:");
int num2 = Convert.ToInt32(Console.ReadLine());

int sum = num1 + num2;

Console.WriteLine($"The sum of {num1} and {num2} is {sum}.");
}
}

----------------------------------------------------
#basicprograms