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 ? | 1 Yes | 2 No |
Post New Answer View All Answers
What is the syntax for a for loop?
Difference between struct and class in terms of access modifier.
How can I learn c++ easily?
What is a base class?
What are the two types of polymorphism?
How a pointer differs from a reference?
Is react oop?
What is set in c++?
Differentiate between structure and class in c++.
Which command properly allocates memory a) char *a=new char[20]; b) char a=new char[20]; c) char a=new char(20.0);
What is stack unwinding?
What is the difference between set and map in c++?
What is a dangling pointer in c++?
Is c# written in c++?
Difference between pointer to constant vs. Pointer constant