I am trying to separate digits of a number and print those individual digits. When I do this -:
#include <stdio.h>
#define size 100
int main()
{
    int num, remainder, arr[size], i=0;
    printf("Enter a number : ");
    scanf("%d", &num);
    while(num != 0)
    {
        remainder = num%10;
        arr[i]=remainder;
        i++;
        num /= 10;
    }
    for(int j=i; j>0; j--)
        printf("%d\t", arr[j]);
    printf("\n");
    return 0;
}
It shows -:
I don't know the reason as to why it's happening. Please help me.
Thank You.
 
    