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 ? | 22 Yes | 4 No |
Post New Answer View All Answers
What are the 5 elements of structure?
What are valid operations on pointers?
Explain pointer. What are function pointers in C?
Difference between constant pointer and pointer to a constant.
Why c language?
What is extern c used for?
Subtract Two Number Without Using Subtraction Operator
What are the storage classes in C?
What is calloc()?
is it possible to create your own header files?
Can one function call another?
How do you determine the length of a string value that was stored in a variable?
about c language
What is array in C
What is header file in c?