Pls tell me why does my c programme does not give any output whenever i input some unhappy number.
#include <stdio.h>
//This is a program to check if a number is happy or not
int main()
{
//code
int n,r,sum,tmp; //n=number,r=remainder
printf("Enter a number:");
scanf("%d",&n);//input number
tmp=n;
do
{ sum=0;
while(tmp>0)
{
r=tmp%10;
sum+=r*r;
tmp=tmp/10;
}
tmp=sum;
}while(tmp>1);
if(sum==1)
{
printf("%d is a happy number",n);
}
else
{
printf("%d is not a happy number",n);
}
return 0;
}