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
Differentiate between late binding and early binding. What are the advantages of early binding?
What is the default width for ouputting a long integer using the insertion operator?
What is basic concept of oop?
explain sub-type and sub class? atleast u have differ it into 4 points?
How delete [] is different from delete?
what are the iterator and generic algorithms.
Why is it necessary to use a reference in the argument to the copy constructor?
What is friend class in c++ with example?
Explain the difference between c & c++?
What is ifstream c++?
What is setbase c++?
What are the three main types of variables?
What is polymorphism and why is it important?
Should I learn c++ c?
Discussion on error handling of C++ .