Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package basicjavalipu2;
- import java.util.Scanner;
- public class BasicJavaLipu2 {
- public static void main(String[] args) {
- Scanner sc=new Scanner(System.in);
- double[] number=new double[5];
- double sum=0;
- System.out.println("please enter 5 numbers: ");
- for (int i = 0; i <number.length; i++) {
- number[i]=sc.nextDouble();
- }
- for (int i = 0; i <number.length; i++) {
- sum=sum+number[i];
- }
- System.out.println("Total Number is: "+sum);
- double ave=sum/number.length;
- System.out.println("\nAverage number: "+ave);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement