31. C Program to Check Middle digit of given 3 digit number is Equal to the Sum of Other Two digits or Not.
How does this program work?
- This Program is used to Check Middle digit of given 3 digit number is Equal to the Sum of Other Two digits or Not.
Here is the code
int main()
{
int number,l,f,m,s;;
printf("Enter Numbers :\n");
scanf("%d",&number);
{
l = number%10;
f = number/100;
m = (number/10)%10;
s = l+f;
}
if(s==m)
{
printf( "Sum of number equal to middle number");
}
else {
printf( "Sum of number not equal to middle number");
}
}