/** * Print an ASCII table: * 1) Print three columns of numbers followed by the
ID: 3754069 • Letter: #
Question
/**
* Print an ASCII table:
* 1) Print three columns of numbers followed by the ASCII character for that
* number. The first column is in the range 32 to 63 in steps of 1. The
* second columns 32 more than that and the third is 64 more than that.
* 2) Print each columns number right aligned to three characters followed by
* a space then the ASCII character for that number. Use tabs between
* columns and a newline at the end of the third column.
* Hints: In printf, %#d will format a decimal number to be right aligned #
* spaces and %c prints the character of the number given.
*
* Example output:
* 32 64 @ 96 `
* 33 ! 65 A 97 a
* 34 " 66 B 98 b
* 35 # 67 C 99 c
* ...
* 62 > 94 ^ 126 ~
* 63 ? 95 _ 127
*/
Explanation / Answer
#include <stdio.h>
int main()
{
int i;
for(i=32;i<=63;i++) {
printf("%d %c %d %c %d %c ",i,i,i+32,i+32,i+64,i+64);
}
return 0;
}
Output:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.