c program with notes
Start by asking the user to enter a number between 100 and 10,000. Check if the user has complied. Keep asking the user for a number between 100 and 10,000 until the user complies.Then print on the screen the digits of that number in reverse order
#include <stdio.h> void positive_int_reverse(int n){ if(n>0){ positive_int_reverse(n/10); printf("%d",n%10); } } int main(){ int n; printf("Enter a number between 100 and 10,000: "); scanf("%d",&n); while(n>=100 && n<=10000){ positive_int_reverse(n); printf("\n\nEnter a number between 100 and 10,000: "); scanf("%d",&n); } return 0; }
Get Answers For Free
Most questions answered within 1 hours.