20 lines
476 B
C
Executable File
20 lines
476 B
C
Executable File
/*
|
|
Exercise 03:
|
|
Implement a ASCII-to-number converter.
|
|
It should ask for a character, display it as a number, then the original character again.
|
|
Insert enough spaces so that the character and number align.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
unsigned char input_char = 0;
|
|
|
|
int main()
|
|
{
|
|
printf("%-17s", "Insert character: ");
|
|
scanf("%c", &input_char);
|
|
printf("%-17s %d\n", "Number: ", input_char);
|
|
printf("%-17s %c\n", "ASCII Character: ", input_char);
|
|
|
|
return 0;
|
|
} |