6.4..Napisati program za ispis prosjeka 5 brojeva.
Listing programa:
package zadatak;
import java.util.Scanner;
public class P06411072 {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
System.out.print("5 brojeva: ");
double a= input.nextDouble();
double b= input.nextDouble();
double c= input.nextDouble();
double d= input.nextDouble();
double e= input.nextDouble();
double p= (a+b+c+d+e)/5;
System.out.println("prosjek 5 brojeva= " + p);
}
}
Ispis na ekranu:
Index
|