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
Can we use struct in c++?
What is std :: endl?
How did c++ get its name?
In c++, what is the difference between method overloading and method overriding?
What are default parameters? How are they evaluated in c++ function?
What is vectorial capacity?
What is a c++ map?
Is facebook written in c++?
What is c++ best used for?
Is it possible for the objects to read and write themselves?
What is ostream in c++?
How do you flush a buffer in c++?
Why is main an int?
what kind of projects are suitable for c and c++
Explain the uses of static class data?