Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- int potencia,base,cont,teste;
- printf("Entre com dois valores maiores que zero: ");
- scanf("%d%d",&base,&potencia);
- teste = base;
- for(cont=1;cont<potencia;cont++){
- base=base*teste;
- }
- printf("resultado %d",base);
- /*
- int x,cont;
- int fatorial = 1;
- printf("Entre com um valor maior que zero: ");
- scanf("%d",&x);
- for(cont=1;cont<=x;cont++){
- fatorial = fatorial*cont;
- }
- printf("O fatorial de %d eh %d",x,fatorial);
- */}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement