Write a program which take Translational motion
value of x 0 , v 0 , t and a from user and return
value of x along its unit.
x = x 0 + v 0 t + 1/2at2
Input:
Output:
value of x 0 , v 0 , t and a from user and return
value of x along its unit.
x = x 0 + v 0 t + 1/2at2
Input:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #include <iostream.h> #include <conio.h> int main() { cout << " Translational motion Formula: x = x 0 + v 0 t + 1/2at^2 \n"; float x, xo, vo, T, t, a, X, t2, b, c ; cout << "Enter the value of xo?\n"; cin >> xo; cout << "Enter the value of vo?\n"; cin >> vo; cout << "Enter the value of t?\n"; cin >> t; cout << "Enter the value of a?\n"; cin >> a; t2= t * t; a = 2 * a; b = a * t2; c = 1/b; T = vo * t; X = xo + T; x = X + c; cout << "\t \"The Answer of x\" = "<< x << endl; getch(); return 0; } |
Output:
Translational motion Formula: x = x 0 + v 0 t + 1/2at^2 Enter the value of xo? 45 Enter the value of vo? 65 Enter the value of t? 34 Enter the value of a? 78 "The Answer of x" = 2255
No comments:
Post a Comment