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

Overview of Go lang

Arrays in C Language

String in golang

Data Types in Go language

Installing go lang

Say Hello world in Go lang

Creating your first html page

Arrays in Go lang

Decision Making in Go lang