Write a program to read the values a, b and c and display x, where
x=a/b–c.
Test the program for the following values:
(a) a = 250, b = 85, c = 25
(b) a = 300, b = 70, c = 70
Answer Posted / hr
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
float a,b,c,x;
cout<<" Enter the value of a,b, &c :"<<endl;
cin>>a>>b>>c;
if((b-c)!=0)
{
x=a/(b-c);
cout<<" x=a/(b-c) = "<<x<<endl;
}
else
{
cout<<" x= infinity "<<endl;
}
return 0;
}
OUTPUT:
Enter the value of a,b,&c:300 70 70
X=infinity
| Is This Answer Correct ? | 2 Yes | 5 No |
Post New Answer View All Answers
What are the benefits of operator overloading?
What is #include sstream?
What are dynamic type checking?
Why do we use polymorphism in oops?
Explain the use of vtable.
Do vectors start at 0 c++?
Is c++ the best programming language?
Is stl open source?
How can an improvement in the quality of software be done by try/catch/throw?
Explain polymorphism?
We all know that a const variable needs to be initialized at the time of declaration. Then how come the program given below runs properly even when we have not initialized p?
How does an stl file work?
How is computer programming useful in real life?
How does stack look in function calls? When does stack overflow? What can you do to remedy it?
When is the destructor called?