# Thread: How do you make calls?

1. ## How do you make calls?

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.

2. You already know how to make function calls, what you need to know is how to define prototypes and function definitions. There is a C tutorial on this site which I'm sure explains it.

As far as your code goes, I would recommend NOT casting your calculations to an int. Why? Because an int % int returns an int, there is absolutely no need to cast an int to an int and it makes the code hard to read.

I would imagine your prototype to be something like:
Code:
`void displayDigits(int num);`