Niloy007

Musa's Problem

Jun 1st, 2020
104
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. int digitPosition(int number) {
  4.     int temp = number, size = 0;
  5.  
  6.     while(temp > 0) {
  7.         temp /= 10;
  8.         size++;
  9.     }
  10.  
  11.     while(size > 1) {
  12.         temp = number % 10;
  13.         number /= 10;
  14.         size--;
  15.     }
  16.     return temp;
  17. }
  18.  
  19. int main() {
  20.     int n;
  21.     scanf("%d", &n);
  22.  
  23.     printf("%d \n", digitPosition(n));
  24. }
RAW Paste Data