#include<stdio.h>
#include<conio.h>
int main(void)
{
int i=012;
int j=046;
int k=056;
printf("i=%d\n",i);
printf("j=%d\n",j);
printf("k=%d\n",k);
getch();
return 0;
}
LOGIC:
Closely observe the value initialization.
It stats with 0 that means it's a octal number but not a decimal.
When it's printed we get the decimal values of the octal no.
So i becomes 10, y becomes 38, z becomes 46.
#include<conio.h>
int main(void)
{
int i=012;
int j=046;
int k=056;
printf("i=%d\n",i);
printf("j=%d\n",j);
printf("k=%d\n",k);
getch();
return 0;
}
LOGIC:
Closely observe the value initialization.
It stats with 0 that means it's a octal number but not a decimal.
When it's printed we get the decimal values of the octal no.
So i becomes 10, y becomes 38, z becomes 46.
U r one hell of an innovative guy !!
ReplyDeleteYour highness.. :)
ReplyDelete