Write a program which take Work value of x and k from user and return value of W along its unit.
W = kx^2 /2
Input:
Output:
W = kx^2 /2
Input:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include <iostream.h> #include <conio.h> int main() { cout << " Work Formula: W = kx^2/2 \n"; float k, x, X, K, W; cout << " Enter the value of x?\n"; cin >> x; cout << " Enter the value of k?\n"; cin >> k; X = x * x; K = k * X; W = K / 2; cout <<"\t \"W (Work)\"= "<< W <<" Joule"<< endl; getch(); return 0; } |
Output:
Work Formula: W = kx^2/2 Enter the value of x? 76 Enter the value of k? 278 "W (Work)"= 802864 Joule
No comments:
Post a Comment