C program code

int zap(int n)
{
if(n<=1)then zap=1;
else zap=zap(n-3)+zap(n-1);
}
then the call zap(6) gives the values of zap
[a] 8 [b] 9 [c] 6 [d] 12 [e] 15

Answer Posted / manishsoni

int zap(int n)
{
int a;
if(n<=1)
a=1;
else
a=zap(n-3)+zap(n-1);
return a;
}
main()
{
int result;
result=zap(6);
printf("%d",result);
getch();
}
it gives us 9;
Manish soni(MoNu)

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a void * in c?

598


An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above

659


write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays

1787


c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above

618


Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

676






What does void main () mean?

736


Is c is a procedural language?

601


How pointers are declared?

564


What is a dynamic array in c?

598


int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;

1128


What is meant by high-order and low-order bytes?

656


Suggesting that there can be 62 seconds in a minute?

599


main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none

727


Explain how can I manipulate strings of multibyte characters?

785


How can I invoke another program (a standalone executable, or an operating system command) from within a c program?

655