Translate

Monday 18 August 2014

Program to read 2 values and display sum

class Sum
{
    public static void main(String args[])
    {
         int a, b;
         Console con = System.console();
         a = Integer.parseInt (con.readLine());
         b = Integer.parseInt (con.readLine());
         sum = a+b;
         System.out.print("Total is :- "+sum);         //we can also wrote con.printf("%d",sum);
    }
}

No comments:

Post a Comment

Total Pageviews