Como sumar potencias
Cerrado
miroro12
miroro12 - 13 feb 2015 a las 07:55
- Message postés
- 2
- Date d'inscription
- lunes, 9 de febrero de 2015
- Estatus
- Miembro
- Última intervención
- martes, 10 de febrero de 2015
miroro12 - 13 feb 2015 a las 07:55
Consulta también:
- Como sumar potencias
- “sumar días a una fecha” ✓ - Foros - Excel
- Como sumar el 30 porciento a una cantidad ✓ - Foros - Ofimática
- Para calcular el total de una factura se suma el subtotal y el iva ✓ - Foros - Ofimática
- Porque al sumar en excel me da cero ✓ - Foros - Excel
- ¿cómo se le suma el porcentaje a un precio? ✓ - Foros - Excel
1 respuesta
camilo43
Modificado por camilo43 el 9/02/2015, 14:55
- Message postés
- 176
- Date d'inscription
- lunes, 9 de febrero de 2015
- Estatus
- Miembro
- Última intervención
- miércoles, 25 de febrero de 2015
Modificado por camilo43 el 9/02/2015, 14:55
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class potencia{
public static void main(String[] args) throws Exception{
int resul = 1, base, exponente;
short i;
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Ingrese base: ");
base = Integer.parseInt(bf.readLine());
System.out.print("Ingrese exponente: ");
exponente = Integer.parseInt(bf.readLine());
for(i=1; i<=exponente; i++){
resul = resul * base;
}
System.out.println("resultado: " +resul);
}
}
import java.io.InputStreamReader;
public class potencia{
public static void main(String[] args) throws Exception{
int resul = 1, base, exponente;
short i;
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Ingrese base: ");
base = Integer.parseInt(bf.readLine());
System.out.print("Ingrese exponente: ");
exponente = Integer.parseInt(bf.readLine());
for(i=1; i<=exponente; i++){
resul = resul * base;
}
System.out.println("resultado: " +resul);
}
}
10 feb 2015 a las 00:09
10 feb 2015 a las 13:06
13 feb 2015 a las 07:55
esta es la parte de la suma
for(int i=0;i<11;i++){
suma+=(Math.pow(opc,i));