java program to calculate average of 5 numbers

Java program to calculate average of 5 numbers


import java.util.Scanner;
import static java.lang.System.out;
public class AverageOfNumber
{      public static void main(String args[]) {
    Scanner Sc= new Scanner(;
    out.println("Enter 1st number");
    float a=Sc.nextFloat();
     out.println("Enter 2nd number");
    float b=Sc.nextFloat();
    out.println("Enter 3rd number");
    float c=Sc.nextFloat();
    out.println("Enter 4th number");
    float d=Sc.nextFloat();
    out.println("Enter 5th number");
    float e=Sc.nextFloat();
    float avg= (a+b+c+d+e)/5;
    out.println("Calculated average sum of five numbers is: "+avg);


About the Author: Make toss

Leave a Reply

Your email address will not be published. Required fields are marked *