Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class nomor3 {
- public static void main (String[]args){
- Scanner in = new Scanner(System.in);
- int a,b;
- float all,x,r;
- System.out.print("Banyaknya Data :");
- b = in.nextInt();
- all = 0;
- a = 1;
- while (a <=b){
- System.out.println("Data Ke "+a+" :");
- x = in.nextFloat();
- all +=x;
- a++;
- }
- r = all/b;
- System.out.println("rata-rata : "+r);
- System.out.println("jumlah : "+all);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement