uva problem

Question

A particle has initial velocity and acceleration. If its velocity after certain time is v then what will its
displacement be in twice of that time?
Input
The input will contain two integers in each line. Each line makes one set of input. These two integers
denote the value of v (−100 ≤ v ≤ 100) and t (0 ≤ t ≤ 200) (t means at the time the particle gains
that velocity)
Output
For each line of input print a single integer in one line denoting the displacement in double of that time.
ans:
#include
int main()
{
int v,t,s;
printf(“enter the value of v=”);
scanf(“%d” , &v);
printf(“enter the value of t=”);
scanf(“%d” , &t);
if(−100<= v<= 100 && 0<= t<= 200); [ the compiler is showing that here is a problem . i don’t understand why ? ]
{
printf(“the distance is =%d” , s=v*2*t);
}
return 0;
}

solved 0
Sanjana ayshi 1 month 2 Answers 44 views 0

Answers ( 2 )

  1. #include
    int main()
    {
    int v,t,s,i;
    while(scanf(“%d %d”,&v,&t)==2)
    {
    s=2*v*t;
    printf(“%dn”,s);
    }
    return 0;
    }

    Best answer
    • Why ==2 ??
      And there was condition v must be under -100 to 100 and t is also 0 to 200 .. why didn’t u use it?

Leave an answer