Advertisement
Jakubowiczish

Untitled

Mar 10th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4. int podstawa;
  5. int wykladnik;
  6. int wynik;
  7.  
  8. printf("podaj podstawe: ");
  9. scanf("%d", &podstawa);
  10. printf("podaj wykladnik: ");
  11. scanf("%d", &wykladnik);
  12.  
  13. if(wykladnik<0)
  14. {
  15. printf("zle dane wyjsciowe, potega nie moze byc ujemna, ");
  16. printf("podaj podstawe: ");
  17. scanf("%d", &podstawa);
  18. printf("podaj wykladnik: ");
  19. scanf("%d", &wykladnik);
  20. }
  21. else
  22. {
  23. wynik=1;
  24.  
  25. while(wykladnik>0)
  26. {
  27. wynik=wynik*podstawa;
  28. wykladnik=wykladnik-1;
  29. }
  30. printf("%d",wynik);
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement