View Code of Problem 104

#include<stdio.h>
int main()
{
    float va,vb,n,t;
    float ts;
    while(scanf("%f%f%f%f",&n,&va,&vb,&t)!=EOF){
        if(n==0){
            printf("0.00\n");
        }
        else{
                if(va<=vb)
                    printf("NO\n");
 
        else{
            ts=n*1000/(va-vb);
            if(ts<=t){
                printf("%.2f\n",ts);
            }
            else{
                printf("NO\n");
            }
        }
        }
    }
  return 0;
}

Double click to view unformatted code.


Back to problem 104