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
how logic is used
What is #include stdlib h?
What are c identifiers?
Is a house a mass structure?
What is a ternary operator in c?
How can I remove the trailing spaces from a string?
how to write optimum code to divide a 50 digit number with a 25 digit number??
What should malloc() do?
What is the auto keyword good for?
What does sizeof return c?
What standard functions are available to manipulate strings?
How can I check whether a file exists? I want to warn the user if a requested input file is missing.
What is typedf?
Explain why can’t constant values be used to define an array’s initial size?
How can I read and write comma-delimited text?