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