In this program, the user is ask to enter the number, then the number equivalent is displayed on Decimal, Octal and Hexadecimal format is displayed on console. The decimal number system uses only ten digits (0 through 9) there are no numbers or letters used above 10. The octal number system uses only eight digits (0 through 7) there are no numbers or letters used above 8. The hexadecimal number system uses only ten digits (0 through 9) and six letters (A through F) . Here, A means 10 B means 11 C means 12 D means 13 E means 14 F means 15
#include<stdio.h>
#include <conio.h>
void main ()
{
int a;
clrscr();
printf("Enter a number :");
scanf ("%d",&a);
printf("Decimal : %d\n",a);
printf("Octal : %o\n",a);
printf("Hexadecimal : %x\n",a);
}
Enter a number :142
Decimal : 142
Octal : 216
Hexadecimal : 8e