View Code of Problem 104

#include<stdio.h>
//#include<math.h>
//#include<string.h>
int main() {
	int n,v1,v2,t;
	double  t,time;

	while(scanf("%d %d %d %lf",&n,&v1,&v2,&t)!=EOF) {
		if(v1<v2)
			printf("N0\n");
		else {
		n*=1000;
			time=(double) n/(v1-v2);
			if(time<=t)
				printf("%.2lf\n",time);
			else
				printf("N0\n");
		}
	}
	return 0;
}
/*
Main.c: In function 'main':
Main.c:6:10: error: conflicting types for 't'
  double  t,time;
          ^
Main.c:5:14: note: previous declaration of 't' was here
  int n,v1,v2,t;
              ^
*/

Double click to view unformatted code.


Back to problem 104