Hey Guys,
Here we discussed about addition of two values.
First time we input two values.first in variable like a and second in variable like b and then add those value in a particular variable like sum.
import java.util.Scanner;
class Add
{
public static void main(String args[])
{
int a,b,sum;
Scanner kb=new Scanner(System.in);
System.out.print("Enter first value :");
a=kb.nextInt();
System.out.print("Enter second value :");
b=kb.nextInt();
sum=a+b;
System.out.println("Addition of two value : "+sum);
}
}
Here we use Scanner Class to enter values of variable of java.util package.
0 Comments
Post a Comment