#include <stdio.h>
int main(void)
{
//data range of unsigned char is in,
//1) decimal format 0 to 255
//2) octal format 0 to 377
//3) hexadecimal format 0 to ff
unsigned char var;
printf("Enter decimal value b/w 0 to 255: ");
scanf("%d", &var);
printf("var = %d\n", var);
printf("Enter octal value b/w 0 to 377: ");
scanf("%o", &var);
printf("var = %o\n", var);
printf("Enter hexadecimal value b/w 0 to ff: ");
scanf("%x", &var);
printf("var = %x\n", var);
return 0;
}
Output
Enter decimal value b/w 0 to 255: 198
var = 198
Enter octal value b/w 0 to 377: 172
var = 172
Enter hexadecimal value b/w 0 to ff: f9
var = f9
Program:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer