Guest User

Untitled

a guest
Jul 23rd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <windows.h>
  3.  
  4. double potega(double p, int w){
  5. double wyn=1;
  6. if(w==0){wyn=1;}else{
  7. int i=1;
  8. for(i=1;i<=w;++i){
  9. wyn*=p;
  10. }//for
  11. }//else
  12. return wyn;
  13. }//potega
  14.  
  15. int main(){
  16. int n, s, i=1, wyn=1;
  17. double rob=1;
  18. printf("n=");
  19. scanf("%d",&n);
  20. printf("\ns=");
  21. scanf("%d", &s);
  22. if (n==1){
  23. wyn=1;
  24. }else{
  25. while(rob<=n){
  26. wyn=i;
  27. ++i;
  28. rob=potega(i,s);
  29. }//while
  30. }//else
  31. printf("wynik=%d \n", wyn);
  32. system ("pause");
  33. return 0;
  34. }
Add Comment
Please, Sign In to add comment