Social Icons

Friday 23 August 2013

Java Program Using Scanner class to take Input from user

import java.util.Scanner;
class New
{
public static void main(String args[])
{
 Scanner s= new Scanner(System.in);
 System.out.println("Enter an integer value ");

 int a = s.nextInt();
 System.out.println("Enter 2nd integer");
 int b= s.nextInt();
 int c=a+b;
 System.out.println("Addition of two no. is "+c);
}


}


output:


      e:\java_programs>java New
Enter an integer value
25
Enter 2nd integer
36
Addition of two no. is 61

No comments:

Post a Comment

 

Sample Text

Sample text

 
Just Programming Cse DriveReputation Management