difference between %i ad %d

%i reads the value and it recognizes the value as what base
it is when we read the value as 023 (base 8) it is 19 (base 10)
and 0xa(base 16) it is 10 in (base 10).


Enter a number:023
Out put:%d=19, %i=19,%x=17

Enter a number:0xa
Out put:%d=10, %i=10,%x=a

int main()
        int num;
        printf("Enter a number:");
        printf("\nOut put:%%d=%d, %%i=%i,%%x=%x",num,num,num);
        return 0;

But note that %i used by scanf() is different than %i used by printf(). For printf(), %i and %d are the same thing.