Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<math.h>
- int main()
- {
- double a,u,v,s,t;
- int b=1,n;
- while(scanf("%d",&n)==1&&n!=0)
- {
- if(n==1)
- {
- scanf("%lf%lf%lf",&u,&v,&t);
- s=((u+v)*t)/2;
- a=(v-u)/t;
- printf("Case %d: %.3lf %.3lf\n",b,s,a);
- }
- else if(n==2)
- {
- scanf("%lf%lf%lf",&u,&v,&a);
- s=(v*v-u*u)/(2*a);
- t=(v-u)/a;
- printf("Case %d: %.3lf %.3lf\n",b,s,t);
- }
- else if(n==3)
- {
- scanf("%lf%lf%lf",&u,&a,&s);
- v=sqrt(u*u+2*a*s);
- t=(v-u)/a;
- printf("Case %d: %.3lf %.3lf\n",b,v,t);
- }
- else if(n==4)
- {
- scanf("%lf%lf%lf",&v,&a,&s);
- u=sqrt(v*v-2*a*s);
- t=(v-u)/a;
- printf("Case %d: %.3lf %.3lf\n",b,u,t);
- }
- b++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement