Skip to main content

Posts

Showing posts with the label Write a program to read the values of a

Write a program to read the values of a, b and c and display the value of x, where x= a/b-c Test your program for the following values: a) a=250, b=85, c=25 b) a=300, b=70, c=70

 Here's the program to read the values of a, b, and c and display the value of x, where x = a/b - c: #include <iostream> using namespace std; int main() {     int a, b, c;     float x;     // first test case     a = 250;     b = 85;     c = 25;     x = a / b - c;     cout << "For values a = " << a << ", b = " << b << ", and c = " << c << endl;     cout << "The value of x is: " << x << endl << endl;     // second test case     a = 300;     b = 70;     c = 70;     x = a / b - c;     cout << "For values a = " << a << ", b = " << b << ", and c = " << c << endl;     cout << "The value of x is: " << x << endl;     return 0; } Output: For values a = 250, b = 85, and c = 25 The value of x is: ...