elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Recopilación Tutoriales y Manuales Hacking, Seguridad, Privacidad, Hardware, etc


  Mostrar Mensajes
Páginas: [1]
1  Programación / Programación C/C++ / Re: Elevar un número a una potencia en C en: 13 Mayo 2019, 23:58 pm
si no queres usar las math podes hacer lo siguiente

#include<stdio.h>

main(){
   
   int potencia=1,base,exponente,i;
   printf("ingrese numero base\n");
   scanf("%i", &base);
   printf("ingrese exponente\n");
   scanf("%i", &exponente);
   for(i=0;i<exponente;i++){
      potencia=potencia*base;
   }
   printf("la potencia es: %i\n" , potencia);

}
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines