import java.util.Scanner;
public class Lab1_5 {
public static void main(String[] args) {
String name;
int a,b;
Scanner name1 = new Scanner (System.in);
System.out.println("Enter your name");
name = name1.nextLine();
Scanner a1 = new Scanner (System.in);
System.out.println("Enter Number 1");
a = a1.nextInt();
System.out.println("Enter Number 2");
Scanner b1 = new Scanner (System.in);
b = b1.nextInt();
System.out.println("You name is "+name);
System.out.println("Sum is "+(a+b));
}
} |
import java.util.Scanner;
public class Lab1_5 {
public static void main(String[] args) {
String name;
int a,b;
Scanner name1 = new Scanner (System.in);
System.out.println("Enter your name");
name = name1.nextLine();
Scanner a1 = new Scanner (System.in);
System.out.println("Enter Number 1");
a = a1.nextInt();
System.out.println("Enter Number 2");
Scanner b1 = new Scanner (System.in);
b = b1.nextInt();
System.out.println("You name is "+name);
System.out.println("Sum is "+(a+b));
}
}