import java.io.DataInputStream;
class Calculate
{
                public static void main(String args[])
                {
                                DataInputStream in=new DataInputStream(System.in);
                                int a=0,b=0,c=0;
                                try
                                {
                                                System.out.println("Enter A First Number : ");
                                                a=Integer.parseInt(in.readLine());
                                                System.out.println("Enter A Second Number : ");
                                                b=Integer.parseInt(in.readLine());
                                }
                                catch(Exception e)
                                {
                                }
                                c=a+b;
                                System.out.println("Sum = "+c);
                }
}

JAVA 8.PNG

Advertisements