Printing Integer : %x %o %d format specifier : C General Multiple Choice Question
Printing Integer : %x %o %d format specifier : C General Multiple Choice Question
What would be the Output of this Program ?
#include<stdio.h> void main() { printf("%d%o%x",50,050,0x50); }
[toggle title=”Output”]50 50 50[/toggle]
Why ?
- %d format specifier is used for Printing Integer
- %o format specifier is used for Printing Octal
- %x format specifier is used for Printing Hexadecimal
- Any number preceded with Zero (040,050,030) are considered as Octal Numbers
- Any number preceded with [ 0x / 0X ] (0x40,0x50,0x30) are considered as Hexadecimal Numbers