Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio-bis.h>
- int n, c, exp, total;
- int main()
- {
- c = 1;
- gotoxy(30,1);
- textcolor(GREEN);
- cprintf("Calculs de puissances");
- textcolor(WHITE);
- printf("\n\nEntrez un nombre: ");
- scanf("%d",&n);
- printf("\nEntrez un exposant: ");
- scanf("%d",&exp);
- if(exp == 0)
- {
- total = 1;
- }
- else if(exp == 1)
- {
- total = n * 1;
- }
- else
- {
- total = n;
- while(c<exp)
- {
- total = total * n;
- c++;
- }
- }
- printf("\nLa puissance est: %d",total);
- getch();
- return 0;
- }
Add Comment
Please, Sign In to add comment