Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- float myDistance(float u,float a,float t);
- float myVelocity(float u,float a,float s);
- int main()
- {
- float u = 20,a = 3, t = 5;
- cout<<"Distance of this car is "<<myDistance(u,a,t)<<endl;
- cout<<"Velocity of this car after passed 5 seconds is "<<myVelocity(u,a,myDistance(u,a,t));
- }
- float myDistance(float u,float a,float t)
- {
- return (u*t)+(0.5*a*pow(t,2));
- }
- float myVelocity(float u,float a,float s)
- {
- return sqrt(pow(u,2)+(2*a*s));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement