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 / gg
Error::invalid lvalue in assignment
for both the statements followed by IF & ELSE .
coz zap is a function name.And trying to assign a value.
if the Code is :
int zap(int n)
{
int zap1;
if(n<=1)
(zap1 = 1);
else
(zap1 = zap(n-3)+zap(n-1));
}
Ans Is :: 1
If the Code is :
int zap(int n)
{
int zap1;
if(n<=1)
return (zap1 = 1);
else
return (zap1 = zap(n-3)+zap(n-1));
}
Ans Is ::9
| Is This Answer Correct ? | 23 Yes | 4 No |
Post New Answer View All Answers
How can my program discover the complete pathname to the executable from which it was invoked?
What does 4d mean in c?
Can we declare function inside main?
What are the Advantages of using macro
What does *p++ do? What does it point to?
List some of the static data structures in C?
Write a program of prime number using recursion.
What are the different categories of functions in c?
swap 2 numbers without using third variable?
Explain b+ tree?
Is it better to bitshift a value than to multiply by 2?
How reliable are floating-point comparisons?
WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.
What is equivalent to ++i+++j?
Explain is it better to bitshift a value than to multiply by 2?