Addition Of two Numbers

 Addition of two numbers


C Program
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,sum;
   printf("Enter First Number:");
   scanf("%d",&a);
   printf("Enter Second Number:");
   scanf("%d",&b);
   sum = a+b;
   printf("The sum of %d and %d is %d",a,b,sum);
}


Java Program
import java.util.Scanner;

public class SimpleProgram {

	public static void main(String[] args) 
	{
		Scanner s = new Scanner(System.in);
		System.out.print("Enter First Number:");
		int a = s.nextInt();
		System.out.print("Enter Second Number:");
		int b = s.nextInt();
		System.out.print("Sum of " + a +" and " + b + " is " + (a+b));
	}

}


Python Program
A = int (input("Enter a Number: "))
B = int (input("Enter a Number: "))
print("Addition of " + str(A) + " and " + str(B) + " is " + str(A+B) )

1 comment:

  1. Sir we want flow chart and algorithm too

    ReplyDelete