in Programming edited by
120 views
1 vote
1 vote

Consider the following C program using function :  

#include<stdio.h>
main()
{
int f1(int,int);
int x = 9, n=3, S;
S = f1(x,n);
printf(S);
}
int f1(int x, int n)
{
int y=1, i=1;
for(i=1;i<=n;i++)
y=y*x;
return(y);
}

Output will be ______

in Programming edited by
by
120 views

1 Answer

1 vote
1 vote
y=9, y=9*9=81, y=81*9=729 ; 729 is the answer

2 Comments

@Bikram Sir what about prototyping of f1 function ?  Is it allowed in main() ?
0
0

Yes we can provide the prototyping in main() also .. the only condition is that it must occur before the function call... 

e.g.

int main(){

      void foo(int);

      foo(1);

     return 0;

}

void foo(int n){

      printf("%d", n);

}
1
1
Answer:

Related questions