Monday, 1 April 2013

How to find some of three numbers in java


find three numbers sum 


import java.util.*;

class A

{

int a,b,c,d;


void get()

{

Scanner sc=new Scanner(System.in);

System.out.print("Enter the Value of a ");

a=sc.nextInt();

System.out.print("Enter the Value of b ");

b=sc.nextInt();

System.out.print("Enter the Value of c ");

c=sc.nextInt();

}

void put()

{

d=a+b+c;

System.out.print("Sum Of a+b+c is = "+d);

}


public static void main(String[] args)

{

A a=new A();

a.get();

a.put();


}}

No comments:

Post a Comment