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 I send mail from within a c program?
What is the best way of making my program efficient?
What is non linear data structure in c?
Can a pointer be volatile in c?
What is the meaning of c in c language?
What is pass by reference in functions?
Compare array data type to pointer data type
What is declaration and definition in c?
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
What does 2n 4c mean?
What is getch?
Is it possible to initialize a variable at the time it was declared?
Why we not create function inside function.
What are c identifiers?
What is a substring in c?