/* 6.write a program to accept an integer and display it in octal and hexadecimal
formats */
#include<stdio.h>
#include<conio.h>
void main()
{
int no=0;
clrscr();
printf("enter a integer:");
scanf("%d",&no);
printf("\n\nentred value is: %d",no);
printf("\n\noctal value is: %o",no);
printf("\n\nhexadecimal value is: %x",no);
getch();
}
/* output:
enter a integer:12
entred value is: 12
octal value is: 14
hexadecimal value is: c
*/
No comments:
Post a Comment