You are on page 1of 2

3 COURSE:BSME

NAME:DE GALA, ALEXTER D. COMPUTER PROGRAMMING


SECTION:GN

Instructions: Write a Java program that takes five numbers as input to calculate and print the average
of the numbers. Take a screenshot of the result and the codes and upload it here as pdf file.

PROGRAM CODE
public class Main
{
public static void main(String [] args) {

int num1 = 3;
int num2 = 5;
int num3 = 7;
int num4 = 9;
int num5 = 1;
int avg = (num1 + num2+ num3+ num4 +num5)/5;

System.out.print(avg +" "+ "is the average of" +


" "+num1+"+"+num2+"+"+num3+"+"+num4+"+"+num5);
}
}
SCREEN SHOT

You might also like