Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


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

Answers were Sorted based on User's Feedback



C program code int zap(int n) { if(n<=1)then zap=1; else zap=zap(n-3)+z..

Answer / 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 ?    20 Yes 3 No

C program code int zap(int n) { if(n<=1)then zap=1; else zap=zap(n-3)+z..

Answer / guest

b

Is This Answer Correct ?    15 Yes 4 No

C program code int zap(int n) { if(n<=1)then zap=1; else zap=zap(n-3)+z..

Answer / deepa

error there is no keyword as then ,therefore it will
treat 'then' as a variable which wud lead it to compilation
error

Is This Answer Correct ?    14 Yes 8 No

C program code int zap(int n) { if(n<=1)then zap=1; else zap=zap(n-3)+z..

Answer / 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

C program code int zap(int n) { if(n<=1)then zap=1; else zap=zap(n-3)+z..

Answer / guest

9

Is This Answer Correct ?    1 Yes 0 No

C program code int zap(int n) { if(n<=1)then zap=1; else zap=zap(n-3)+z..

Answer / madhu

if (n<=1)
zap = 1;
it gives a compile time error invlaid l value assignment.
zap is a function and cannot be assigned a value

Is This Answer Correct ?    1 Yes 5 No

Post New Answer



More C Interview Questions

how many header file is in C language ?

43 Answers   College School Exams Tests, CTS, IBM, IMS, Infosys, ME, Sign Solutions, Wipro, XVT,


What is a MAC Address?

0 Answers  


ASCII stands for

0 Answers  


the expression a=30*1000+2768; evalutes to a) 32768 b) -32768 c) 113040 d) 0

0 Answers  


Can we access RAM? How? Whats the range of access? Similarly What are other hardware we can access?

1 Answers  






What is the difference between class and object in c?

0 Answers  


Given below are three different ways to print the character for ASCII code 88. Which is the correct way1) char c = 88; cout << c << " ";2) cout.put(88);3) cout << char(88) << " "; a) 1 b) 2 c) 3 d) constant

0 Answers  


What does c mean before a date?

0 Answers  


2.Given the short c program that follows a. make a list of the memory variables in this program b.which lines of code contain operations that change the contents of memory? what are those operations? Void main( void) { Double base; Double height; Double area; Printf(“enter base and height of triangle :”); Scanf(“%lg”, &base); Scanf(“%lg”, &height); Area=base*height/2.0; Printf(“the area of the triangle is %g \n”,area); }

1 Answers   Wipro,


How can you increase the allowable number of simultaneously open files?

0 Answers  


macros and function are related in what aspect? a)recursion b)varying no of arguments c)hypochecking d)type declaration

12 Answers   HCL, Infosys, Microsoft,


What is sizeof array?

0 Answers  






Categories