NODjS PROGRAMMING
2.57K subscribers
89 photos
23 files
4 links
Hello! I am @imabhi3030 and welcome to the Coding channel! Here we can learn all things related to coding and improve our skills. I am always present to help you. If you need any kind of assistance, just let me know! 😊
Download Telegram
Program to add two numbers
-------------------------------------------------
Program:


function addNumbers(a: number, b: number): number {
return a + b;
}

const num1: number = 5;
const num2: number = 7;

const sum: number = addNumbers(num1, num2);

console.log(The sum of ${num1} and ${num2} is ${sum});

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

using System;

namespace AddTwoNumbers
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter the first number: ");
int num1 = int.Parse(Console.ReadLine());

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

int sum = num1 + num2;

Console.WriteLine("The sum of {0} and {1} is {2}.", num1, num2, sum);
}
}
}

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