(i.e. 35 ?2 ?) is 11, length of 2nd simple input also 11, and the length of the last simple input is 5.
2) Shouldn't the output contain any trailing zero after decimal point ? such that sample output 1 is 2.6 , if the output be 2.600, will the program get WA?
3) If the output is an integer, shouldn't it contain decimal point ? such that sample output 1 is 3 , if the output be 3.000, will the program get WA?
5) If ans for abpve 2) and 3) is yes, how to control it ?
6) Please give some sample input and output for this problem.
My bellow program getting WA-
Code: Select all
#include<stdio.h>
#include<string.h>
int main()
{
char dis[500];
int len,c,t;
double w;
scanf("%d",&t);
getchar();
for(c=1;c<=t;c++)
{
gets(dis);
len=strlen(dis);
if(len==5)
w=(dis[0]-'0')*0.5;
else
w=(dis[0]-'0')*0.5 + (dis[6]-'0')*0.05;
printf("Case %d: %lf\n",c,w);
}
return 0;
}