Write a program that prompts a user for an integer value inthe range 0 to 32,767
ID: 3610194 • Letter: W
Question
Write a program that prompts a user for an integer value inthe range 0 to 32,767 and then prints the individual digits of thenumber on a line with three spaces between the digits. The firstline is to start with the leftmost digit and print all five digits;the second line is to start with the secong digit from the left andprint four digits, and so forth. For example, if the user enters1234, your program should print 0 1 2 3 4 1 2 3 4 2 3 4 3 4 4 Write a program that prompts a user for an integer value inthe range 0 to 32,767 and then prints the individual digits of thenumber on a line with three spaces between the digits. The firstline is to start with the leftmost digit and print all five digits;the second line is to start with the secong digit from the left andprint four digits, and so forth. For example, if the user enters1234, your program should print 0 1 2 3 4 1 2 3 4 2 3 4 3 4 4Explanation / Answer
please rate - thanks #include #include int main() {int n=10000,i,j,temp,left,digit,tempn,num; printf("Enter a number: "); scanf("%d",&num); for(i=0;i=1;j--) {digit=temp/tempn; temp=temp-digit*tempn; printf("%d ",digit); tempn/=10; } num%=n; n/=10; printf(" "); } getch(); return 0; }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.