Answer :
Answer:
Follows are the code to this question:
#include <stdio.h>//defining header file
void extractDigits (int n)//defining a method extractDigits that holds
{
int x;//defining integer variable
while (n > 0)//defining while loop for check value is greater than 0
{
x = n % 10;//holding remainder value
n = n / 10;// holding quotient value
printf("%d\n", x);//print remainder value
}
}
int main ()//defining main method
{
extractDigits (54321);//calling above method by passing integer value
}
Output:
1
2
3
4
5
Explanation:
In the above-given code a method "extractDigits" is defined that accepts an integer parameter, and inside the method an integer variable is declared, that use while loop to check value is greater than 0, and calculate the individual digits, and print its values, and inside the main method we call the above method.