Guest User

Untitled

a guest
Feb 21st, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio-bis.h>
  3.  
  4. int n, c, exp, total;
  5. int main()
  6. {
  7.     c = 1;
  8.     gotoxy(30,1);
  9.     textcolor(GREEN);
  10.     cprintf("Calculs de puissances");
  11.     textcolor(WHITE);
  12.     printf("\n\nEntrez un nombre: ");
  13.     scanf("%d",&n);
  14.     printf("\nEntrez un exposant: ");
  15.     scanf("%d",&exp);
  16.     if(exp == 0)
  17.     {
  18.          total = 1;
  19.     }
  20.     else if(exp == 1)
  21.     {
  22.          total = n * 1;
  23.     }
  24.     else
  25.     {
  26.         total = n;
  27.          while(c<exp)
  28.         {      
  29.             total = total * n;
  30.             c++;
  31.         }
  32.     }
  33.     printf("\nLa puissance est: %d",total);
  34.     getch();
  35.     return 0;
  36. }
Add Comment
Please, Sign In to add comment