Sum of 3 digits of a number - C Program

C program to read 3 digit number and print sum of all 3 digits.

Solution:

#include <stdio.h>
int main()
{
      int n,l,f,m,sum,t1;
      printf("Enter 3-Digit Number: ");
      scanf("%d",&n);
      f=n/100;
      t1=n%100;
      l=t1%10;
      m=t1/10;
      printf("\nFirst Digit  = %d \nMiddle Digit = %d \nLast Digit   = %d\n",f,m,l);
      sum=l+m+f;
      printf("\nSum of All 3-Digits : %d",sum);
      return 0;
}


Output:

sum three digit