print_any_digit
| print_any_digit | |
|---|---|
| Turn-in directory | 01_print_any_digit/ |
| Files to turn in | print_any_digit.c |
| Allowed functions | putchar |
- Write a function which prints only the digit in the position specified by
positionof the unsigned integernumrepresented in the decimal numeral system. - The first position is represented by the value
0. Since the decimal numeral system has infinite positions, all positions always have a value! Even when you normally wouldn't print/write that value.
include <stdio.h>
void print_any_digit(unsigned int num, unsigned int position);
int main()
{
print_any_digit(2839, 2);
return 0;
}
Example output:
$ ./a.out
8$