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

Why c is procedure oriented?

556


Explain what is the advantage of a random access file?

648


Why calloc is better than malloc?

561


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

598


Is swift based on c?

622






What is a pointer in c plus plus?

679


What's the best way of making my program efficient?

613


Why is c platform dependent?

609


What is the difference between far and near in c?

583


What is local and global variable in c?

604


What is a constant?

622


What is bash c?

544


What is assert and when would I use it?

566


How can I read data from data files with particular formats?

591


Explain the difference between getch() and getche() in c?

554