JavaScript - NECESITO AYUDA ME SALE ;EXPECTED

 
Vista:
sin imagen de perfil
Val: 2
Ha aumentado su posición en 629 puestos en JavaScript (en relación al último mes)
Gráfica de JavaScript

NECESITO AYUDA ME SALE ;EXPECTED

Publicado por adam (1 intervención) el 05/06/2021 20:45:21
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.io.*;
 
public class arreglos01 {
 
	public static void mostrar_datos_arreglo(double sueldos[], double n) {
		int i;
		double suma;
		suma = 0;
		for (i=1;i<=n;i++) {
			if (i<n) {
				System.out.print(sueldos[i-1]+"+");
			} else {
				System.out.print(sueldos[i-1]+" = ");
			}
			suma = suma+sueldos[i-1];
		}
		System.out.println(suma+" S/.");
		System.out.println("Promedio = "+suma/n+" S/.");
	}
 
	public static void main(String args[]) throws IOException {
		BufferedReader bufEntrada = new BufferedReader(new InputStreamReader(System.in));
		int i;
		int n;
		String sueldos[];
		do {
			System.out.print("Ingrese cantidad de sueldos: ");
			n = Integer.parseInt(bufEntrada.readLine());
		} while (n<1);
		sueldos = new String[n];
		for (i=1;i<=n;i++) {
			System.out.print("Ingrese sueldo["+i+"]: ");
			sueldos[i-1] = bufEntrada.readLine();
		}
		System.out.println("");
		mostrar_datos_arreglo(sueldos,n);
	}
 
 
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder