what will be the output off the following program?
#include<stdio.h>
int main()
{
int a;
a=015+0*71+5;
printf("%d,a");
return0;
}

Answers were Sorted based on User's Feedback



what will be the output off the following program? #include<stdio.h> int main() { int a; ..

Answer / srinivasu

18,a

Is This Answer Correct ?    12 Yes 7 No

what will be the output off the following program? #include<stdio.h> int main() { int a; ..

Answer / yateesh kumar

Garbage value,a

Is This Answer Correct ?    5 Yes 0 No

what will be the output off the following program? #include<stdio.h> int main() { int a; ..

Answer / shiv

015 is octal number its decimal equivalent is = 5 * 8 ^ 0 +
1 * 8 ^ 1 = 5 + 8 = 13
0*71 is 0
then finally , a = 13 + 0 + 5 = 18

Is This Answer Correct ?    6 Yes 1 No

what will be the output off the following program? #include<stdio.h> int main() { int a; ..

Answer / aravind

error bcoz of format specifier.

Is This Answer Correct ?    11 Yes 7 No

what will be the output off the following program? #include<stdio.h> int main() { int a; ..

Answer / sandeep bussa

18

Is This Answer Correct ?    2 Yes 2 No

what will be the output off the following program? #include<stdio.h> int main() { int a; ..

Answer / santhosh

c guys v havi an error on
printf("%d,a");
where the semicolon is ended after "a"...
so
printf("%d",a);
then the ans is 18.

Is This Answer Correct ?    2 Yes 2 No

what will be the output off the following program? #include<stdio.h> int main() { int a; ..

Answer / dhaval

the main point of answer is that the whole program will run
without a single damn error as it ignores %d (called the
conversion character) and just print "a" as text.

so the answer will be a.

if we write the printf statement as printf ("%d",a); in this
case it shall print the answer as 18. dont know why it
prints 18. am on my way to discover this problem out. i will
post a new answer if at all i shall find an answer to this query

regards,
Dhaval. (L.j college of computer applications.)

Is This Answer Correct ?    2 Yes 2 No

what will be the output off the following program? #include<stdio.h> int main() { int a; ..

Answer / uma

printf("%d,a"); this gives an error like a value never
used..or if printf statement like printf("%d",a); then it
gives 18 as the answer because 015 is the octal number and
0*71 is 0.
so a=13+5
a=18;

Is This Answer Correct ?    0 Yes 1 No

what will be the output off the following program? #include<stdio.h> int main() { int a; ..

Answer / shilpa sarkar

error occurs in format

Is This Answer Correct ?    2 Yes 6 No

Post New Answer

More C Interview Questions

how to create c progarm without void main()?

1 Answers   NIIT,


write a program to display all prime numbers

0 Answers  


why programs in c are running with out #include<stdio.h>? some warnings are display in terminal but we execute the program we get answer why? eg: main() { printf("hello world "); }

0 Answers  


What is the purpose of realloc()?

0 Answers  


How can I prevent other programmers from violating encapsulation by seeing the private parts of my class?

1 Answers  






What is declaration and definition in c?

0 Answers  


What is #pragma directive?how it is used in the program? what is its advantages and disadvantages?

2 Answers  


What is difference between structure and union in c?

0 Answers  


There are 21 people in a room. They have to form groups of 3 people each. How many combinations are possible? Write a C program to print the same.

1 Answers   HCL, iGate,


void main() { char c; while(c=getchar()!='\n') printf("%d",c); } o/p=11 why?

8 Answers   Wipro,


#include<stdio.h> void main() { int a=10,b=20,c=30; printf("%d",scanf("%d%d%d",&a,&b,&c)); } what is the output for this?

4 Answers   IIIT,


int a=20; int b=30; int c=40; printf("%d%d%d"); what will be the output?

5 Answers   CMC,


Categories