Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <windows.h>
- double potega(double p, int w){
- double wyn=1;
- if(w==0){wyn=1;}else{
- int i=1;
- for(i=1;i<=w;++i){
- wyn*=p;
- }//for
- }//else
- return wyn;
- }//potega
- int main(){
- int n, s, i=1, wyn=1;
- double rob=1;
- printf("n=");
- scanf("%d",&n);
- printf("\ns=");
- scanf("%d", &s);
- if (n==1){
- wyn=1;
- }else{
- while(rob<=n){
- wyn=i;
- ++i;
- rob=potega(i,s);
- }//while
- }//else
- printf("wynik=%d \n", wyn);
- system ("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment