/* program for taking input using Scanner Class*/
package scanner;
import java.util.Scanner;
class Parent
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int a,b,c;
System.out.println("Enter the first value :");
a=sc.nextInt();
System.out.println("Enter 2nd value :");
b=sc.nextInt();
c=a+b;
System.out.println("Sum is :"+c);
sc.close();
}
}
import java.util.Scanner;
class Parent
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int a,b,c;
System.out.println("Enter the first value :");
a=sc.nextInt();
System.out.println("Enter 2nd value :");
b=sc.nextInt();
c=a+b;
System.out.println("Sum is :"+c);
sc.close();
}
}
output
No comments:
Post a Comment