Computer Science, asked by gururandhawa121, 7 months ago

write a program in Java to input five numbers,calculate the sum and average of the numbers and print the result along the appropriate massage​

Answers

Answered by Anonymous
24

Answer:

import java.util.Scanner;

public class Exercise12 {

public static void main(String[] args) {

 Scanner in = new Scanner(System.in);

 

 System.out.print("Input first number: ");

 int num1 = in.nextInt();

 

 System.out.print("Input second number: ");

 int num2 = in.nextInt();

 

 System.out.print("Input third number: ");

 int num3 = in.nextInt();

 

 System.out.print("Input fourth number: ");

 int num4 = in.nextInt();

 

 System.out.print("Enter fifth number: ");

 int num5 = in.nextInt();

 

System.out.println("Sum of five numbers is: " +

   (num1 + num2 + num3 + num4 + num5) ;  

System.out.println("Average of five numbers is: " +

  (num1 + num2 + num3 + num4 + num5) / 5);

System.out.print("Hope it helped and like my answer");

}

}

Answered by priyanshipareek45
3

Answer:

mark as brainliest and like the answer

Attachments:
Similar questions