Sum of two numbers

program to find sum of two numbers

C Programming

int main() {
int a,b,sum;
printf("Enter any two numbers: ");
sum = a + b;
printf("Total = %d",sum);
return 0;

C++ Programming

using namespace std;
int main() {
int a,b;
cout << "Enter any two numbers: ";
cin >> a >> b;
int sum = a + b;
cout<<"Total = "<<sum;
return 0;


import java.util.Scanner;
class Sum {
public static void main(String args[]) {
int a,b;
Scanner sc = new Scanner(;
System.out.print("Enter any two numbers: ");
a = sc.nextInt();
b = sc.nextInt();
int sum = a + b;
System.out.print("Total = "+sum);

Go Lang

package main
import "fmt"
func main() {
var a,b int32
fmt.Print("Enter any two numbers: ")
sum := a + b
fmt.Print("Total = ",sum)



<!doctype html>
<title>Sum of two numbers</title>
<form method="post" action="doSum.php">
<p>Number-1: <input type="number" name="num1"></p>
<p>Number-2: <input type="number" name="num2"></p>
<p><input type="submit" name="sub" value="Sum"></p>


if(isset($_POST['sub'])) {
$a = $_POST['num1'];
$b = $_POST['num2'];
$sum = $a + $b;
echo "Total = ".$sum;


Popular posts from this blog

Program to calculate telephone bill

Sum of two numbers in go lang

Program to check a year is leap year or not.

String in golang


Arrays in C Language

Reserved Words in Java

Data types in Java

Pointers in C Language

Literals in Java