java code online - Addition of Two Numbers using java programming

Programming languages or concepts
0

 Addition of Two Numbers using java programming language:-

Hey friends in this tutorial we are see how to calculate the sum of two number using java programming with sources code ,

using as bellows input produce the  equivalent output


INPUT :-

  First Number is =  int  a=1010   & 

        Second Number is = int  b=1011

       Calculate / Store result in Variables in: int c;


Corresponding output like this:

      c =   a  + b;

    hence, c = 1010 + 1011;

           c = 2021  // this result stored in variable c

public class Addition{

    public static void main(String[] args){

    int a=1010,b=1011, c;

   

    System.out.println("\n numbers is :-" + "First number is =" + a +  "\n Second number is  =" + b );

     c = a + b ;

     System.out.println("Sum of the numbers is =" +c );

    }

}

OUTPUT:-

                         numbers is :-

                        First number is =1010

                        Second number is  =1011

                        Sum of the numbers is =2021



in this program we used the integer variable to store integer data in that variable , we required
 three int variable,

Two for store number that we are add using Arithematric Addition (+) Operator to add to operant/variable into Thread Variable

using Assingmen t(=) operator 





Post a Comment

0Comments

Post a Comment (0)
close