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
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 |
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 |
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 |
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 are integer variable, floating-point variable and character variable?
What is the acronym for ansi?
Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?
5 Write an Algorithm to find the maximum and minimum items in a set of ‘n’ element.
To what value are pointers initialized? 1) NULL 2) Newly allocated memory 3) No action is taken by the compiler to initialize pointers.
f(*p) { p=(char *)malloc(6); p="hello"; return; } main() { char *p="bye"; f(p); printf("%s",p); } what is the o/p?
wat is the meaning of c?
when i declare as: void main() { clrscr(); int a=10; printf("%d",a) } my problem that why generate a error in above programs. please tell me answer seriously .
Is it possible to have a function as a parameter in another function?
input may any number except 1,output will always 1.. conditions only one variable should be declare,don't use operators,expressions,array,structure
what is difference between array and structure?
44 Answers College School Exams Tests, CTS, Google, HCL, IBM, Motorola, TCS,
what is linkage error when it occurs in c program