Instructions:
Input
1. An integer
Output
The first line will contain a message prompt to input the integer.
The succeeding lines contain the digits of the integer.
Enter·n:·214
4
1
2
#include <stdio.h>
int main()
{
int n;
printf("Enter n: ");
scanf("%d", &n);
while (n != 0)
{
printf("%d\n", n % 10);
n /= 10;
}
return 0;
}
Comments
Leave a comment