Sunday, July 12, 2009

Can anyone please help me with this C program??

#include%26lt;stdio.h%26gt;


void main()


{


int a=012;


int b=034;


int c=056;


printf("a= %d\n",a);


printf("b=%d\n",b);


printf("c=%d\n",c);


}


if u tell me the answers r


a=12


b=34


c=56


then yr answer is wrong...when u run this program the answer is


a=10


b=28


c=46


can anyone tell me how we got these values.please its urgent

Can anyone please help me with this C program??
Your numerical constants are prefixed with an '0' which makes them octal (base 8).
Reply:Numbers starting with a 0 are interpreted as octal.





012 = octal 12 = 1*8 + 2 = 10





and so on.


No comments:

Post a Comment