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 can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?

0 Answers  


Write a program to print the following series 2 5 11 17 23 31 41 47 59 ...

2 Answers  


what is diference between return 0 and return NULL??

3 Answers  


How to write a program for swapping two strings without using 3rd variable and without using string functions.

7 Answers   iGate, Infotech,


Print all numbers which has a certain digit in a certain position eg: number=45687 1 number=4 2 number=5 etc

4 Answers  






Whether there can be main inside another main?If so how does it work?

14 Answers   Sail, Wipro,


How can I remove the leading spaces from a string?

0 Answers  


p*=(++q)++*--p when p=q=1 while(q<=6)

0 Answers   KINPOE,


how the compiler treats any volatile variable?Explain with example.

1 Answers   Tata Elxsi,


What is the real difference between arrays and pointers?

27 Answers   Hexaware, Logic Pro, TCS,


how does a general function , that accepts an array as a parameter, "knows" the size of the array ? How should it define it parameters list ?

0 Answers  


Can we declare variables anywhere in c?

0 Answers  


Categories