//Sum.java
/** Find the sum of two numbers taking input using Scanner class */
//note: remove the double back slash before import package before compilation
//import java.util.Scannner;
public class Sum
{
public static void main(String [] args)
{
Scanner input = new Scanner(System.in);
int a = input.nextInt();
int b = input.nextInt();
System.out.println(" sum of "+a+ "and"+b+" = "+(a+b));
}
}
/* note: if you want to take input in double or float just
use float a = input.nextfloat();
or
double a = input.nextDouble(); */
/** Find the sum of two numbers taking input using Scanner class */
//note: remove the double back slash before import package before compilation
//import java.util.Scannner;
public class Sum
{
public static void main(String [] args)
{
Scanner input = new Scanner(System.in);
int a = input.nextInt();
int b = input.nextInt();
System.out.println(" sum of "+a+ "and"+b+" = "+(a+b));
}
}
/* note: if you want to take input in double or float just
use float a = input.nextfloat();
or
double a = input.nextDouble(); */
Comments
Post a Comment