Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- int b, e, i, p = 1;
- printf("Inserire la base:");
- scanf("%d", &b);
- printf("Inserire l'esponente:");
- scanf("%d", &e);
- if (e>=0) {
- for (i = 1; i <= e; i++) {
- p = b * p;
- printf("%d elevato alla %d e' %d \n", b, i, p);
- };
- } else {
- float q = 1;
- for (i=1; i<=e; i++) {
- p = b * p;
- };
- q = 1 / p;
- printf("%d elevato alla -%d e' %f \n", b, i, q);
- };
- return 0;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement