ch2-Automatic Conversions (int to char, octal, hex)

Chapter_2     Exercise_2-3     btoi squeeze     Exercise_2-4







autoconv.c         download


#include <stdio.h> // for printf(), scanf()
// automatic conversions
int main()
{
int c;

printf("Input decimal number: ");
scanf("%d", &c);

printf("Int:\t%d\n", c);
printf("Char:\t%c\n", c);
printf("Octal:\t%o\n", c);
printf("Hex:\t%x\n", c);

return 0;
}
/*
gcc autoconv.c -o autoconv
./autoconv
Input decimal number: 84
Int: 84
Char: T
Octal: 124
Hex: 54
*/









Chapter_2     Exercise_2-3     btoi BACK_TO_TOP squeeze     Exercise_2-4



Comments

Popular posts from this blog

Contents

Blogger Page Margins in Contempo