Computer Science, asked by padhytanmayee, 4 months ago

write an algorithm to input 3 numbers and find their sum​

Answers

Answered by shumitra
1
  • Following are the algorithm of the sum and the average of three numbers is given below.
  • Explanation:
  • Step 1: Start.
  • Step 2 :Read the three number suppose "a","b","c" form the user.
  • Step 3: Declared a variable "sum" and "Avg".
  • Step 4 : sum=a+b+c;
  • Step 5: Avg=sum/3.
  • Step 6:Display "sum " and "Avg".
  • Step 7 :End .
Answered by ndayipacs2001
0

Answer:

  public class AddNumbers {

   public static void main(String[]args){

   Scanner inpt = new Scanner(System.in);  // function to get input from    keyboard

//Asking user to inputs numbers to add

System.out.println("Dear User please enter your 3 numbers of  your choice:");

int val1= inpt.nextInt(); // getting 1st input

int val2= inpt.nextInt(); // getting 2nd input

int val3= inpt.nextInt(); //getting 3rd input

int summ= val1+val2+val3;  // Add 3 numbers

System.out.println("their summ is:"+summ); // displaying result

   }

}

Explanation:

i have tried to put comments for easy understanding

Similar questions