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 is inheritance write a program to show use of inheritance?
Why is that unsafe to deal locate the memory using free( ) if it has been allocated using new?
How does the copy constructor differ from the assignment operator (=)?
Explain Text Manipulation Routines?
What data encapsulation is in c++?
What is static in c++?
Of the numbers 12 23 9 28 which would be at the top of a properly implemented maxheap a) 28 b) 9 c) Any of them could be
Explain the auto storage classes in c++.
Who discovered c++?
Describe how to safeguard a system through acquisition of an antivirus Program and systematic backup.
What is input operator in c++?
What are the types of abstraction?
When should we use container classes instead of arrays?
How much do coding jobs pay?
Why is abstraction used?