fork(2) download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int i=0;
  6. int j=0;
  7. int p=5;
  8. int n = 123456;
  9. int digits[12]={};
  10.  
  11. j=n;
  12. while(j)
  13. {
  14. digits[i]=j%10;
  15. j = j/10;
  16. i++;
  17. }
  18.  
  19. printf("The digit of %d in the position %d is %d",n,p,digits[i-p]);
  20. return 0;
  21. }
Success #stdin #stdout 0s 2156KB
stdin
Standard input is empty
stdout
The digit of 123456 in the position 5 is 5