Welcome to Westonci.ca, the ultimate question and answer platform. Get expert answers to your questions quickly and accurately. Join our platform to connect with experts ready to provide precise answers to your questions in various areas. Experience the ease of finding precise answers to your questions from a knowledgeable community of experts.
Sagot :
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.
Thanks for using our platform. We aim to provide accurate and up-to-date answers to all your queries. Come back soon. Thank you for visiting. Our goal is to provide the most accurate answers for all your informational needs. Come back soon. We're glad you chose Westonci.ca. Revisit us for updated answers from our knowledgeable team.