A program to calculate the sum of two integers.

Here, we have a basic program example to calculate the sum of two numbers using different languages. This program is created in c language, c++, Java, and Python.

Program to calculate sum of two numbers in C language

#include <stdio.h>
int main() {
    int num1, num2, sum;
    printf("Enter two integers: ");
    scanf("%d %d", &num1, &num2);
    sum = num1 + num2;
    printf("%d + %d = %d", num1, num2, sum);
    return 0;
}

Program to calculate sum of two numbers in C++ language

#include <iostream>
using namespace std;
int main() {
  int num1, num2, sum;
  cout << "Enter two integers: ";
  cin >> num1 >> num2;
  sum = num1 + num2;
  cout << num1 << " + " <<  num2 << " = " << sum;
  return 0;
}

Program to calculate sum of two numbers in Python language

num1 = input('Enter first number: ')
num2 = input('Enter second number: ')
sum = float(num1) + float(num2)
print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))

Program to calculate sum of two numbers in Java language

import java.util.Scanner;
public class SumOfNumbers
  {
       public static void main(String args[])
          {
              int num1, num2, sum;
              Scanner sc = new Scanner(System.in);
              System.out.print("Enter the first number:");
              num1=sc.nextInt();
              System.out.print("Enter the second number:");
              num2=sc.nextInt();
              sum=num1 + num2;
              System.out.println("The sum of two numbers is :"+sum);
          }
   }