Code: Select all

```
#include <stdio.h>
int firstsum(char *inp)
{
int i=0,sum=0;
while(inp[i])
{
if(inp[i]>='a' && inp[i] <='z')
sum+=inp[i]-'a'+1;
else if(inp[i]>='A' && inp[i] <='Z')
sum+=inp[i]-'A'+1;
i+=1;
}
return sum;
}
int sumnum(int num)
{
int sum=0;
while(num)
{
sum+=num%10;
num/=10;
}
return sum;
}
int main()
{
char x[30],y[30];
int sumx,sumy;
float ratio;
while(!feof(stdin))
{
gets(x);
sumx=firstsum(x);
while(sumx>=10)
sumx=sumnum(sumx);
gets(y);
sumy=firstsum(y);
while(sumy>=10)
sumy=sumnum(sumy);
if(sumx > 0 && sumy > 0)
{
if(sumx>sumy)
ratio = ((float)sumy/(float)sumx)*100.0f;
else
ratio = ((float)sumx/(float)sumy)*100.0f;
}
else if(sumx==0 && sumy == 0)
{
printf("\n");
continue;
}
else
{
printf("0.00 %%\n");
continue;
}
printf("%.2f %%\n",ratio);
}
return 0;
}
```

-I print blank line if both sums are 0

-I print upto 2 decimal points accuracy

Are there any special inputs?