#include <stdio.h>
int main(){
int number;
printf("Enter a four-digit positive integer: ");
scanf("%d", &number);
if(number < 1000 || number > 9999)
{
printf("Wrong number.\n");
}else{
for(int i=1000;i>=10;i/=10){
printf("%d\n",(number / i) % 10);
}
printf("%d\n", (number % 10));
}
scanf("%d", &number);
return 0;
}
Comments
Leave a comment