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

Explain how can I pad a string to a known length?

654


How can I recover the file name given an open stream?

553


Is r written in c?

722


Explain what is the difference between text files and binary files?

617


Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58

1117






#include main() { char s[] = "Bouquets and Brickbats"; printf(" %c, ",*(&s[2])); printf("%s, ",s+5); printf(" %s",s); printf(" %c",*(s+2)); }

666


What is structure pointer in c?

571


What are the application of c?

646


Differentiate between functions getch() and getche().

622


What is null pointer in c?

595


which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;

2401


Why c is called a mid level programming language?

605


What is pointer & why it is used?

602


What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.

1781


Describe explain how arrays can be passed to a user defined function

605