Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Avrgg{
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- double[] nums = new double[5];
- int i = 0;
- double summ = 0;
- while(i<5) {
- System.out.print("Enter num "+i+" > " );
- double x = sc.nextDouble();
- nums[i] = x;
- summ += x;
- i++;
- }
- for(int o = 0 ; o<5;o++) {
- System.out.print(nums[o]+ " " );
- }
- System.out.println("][ average is : "+summ/5);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement