#include<stdio.h>
int main()
{
int num,r1,d1,d2,r2,sum;
printf("enter a number:");
scanf("%d",&num);
while(num>99&&num<1000)
{
r1=num/100;
d1=num%10;
d2=r1/10;
r2=r1%10;
sum=d1+d2+r2;
}
printf("sum of three digits=%d",sum);
return 0;
}
I2luY2x1ZGU8c3RkaW8uaD4KaW50IG1haW4oKQp7CiAgICBpbnQgbnVtLHIxLGQxLGQyLHIyLHN1bTsKICAgIHByaW50ZigiZW50ZXIgYSBudW1iZXI6Iik7CiAgICBzY2FuZigiJWQiLCZudW0pOwogICAgd2hpbGUobnVtPjk5JiZudW08MTAwMCkKICAgIHsKICAgICAgIHIxPW51bS8xMDA7IAogICAgICBkMT1udW0lMTA7CiAgICAgIGQyPXIxLzEwOwogICAgICByMj1yMSUxMDsKICAgICAgc3VtPWQxK2QyK3IyOwogICAgfQogICAgcHJpbnRmKCJzdW0gb2YgdGhyZWUgZGlnaXRzPSVkIixzdW0pOwogICByZXR1cm4gMDsKfQ==