It asked to write a function displayDigit() that will ask the user for an integer. The function will then print out the 1-digit, 10-digit, and 100-digit. The function will also print the average
of the 1-digit, 10-digit, and 100-digit.
I got this part and the code is:
Code:
#include <stdio.h>
int main () {
int iVar;
printf( "Enter an integer: " );
scanf( "%d", &iVar );
printf( "The 1-digit is %d\n", (int) (iVar) % 10 );
printf( "The 10-digit is %d\n", (int) (iVar / 10) % 10 );
printf( "The 100-digit is %d\n", (int) (iVar / 100) % 10 );
printf( "The average of the three digits is %d\n",
( ((int) (iVar) % 10) + ((int) (iVar / 10) % 10) +
((int) (iVar / 100) % 100) )/3 );
return 0;
}
It asked me to write a program in main() that will make two (2) calls to displayDigit().
I'm not sure how to make the function called displayDigit() and make 2 calls.