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


Please Help Members By Posting Answers For Below Questions

What is the syntax for a for loop?

603


Difference between struct and class in terms of access modifier.

699


How can I learn c++ easily?

625


What is a base class?

606


What are the two types of polymorphism?

596






How a pointer differs from a reference?

696


Is react oop?

615


What is set in c++?

660


Differentiate between structure and class in c++.

604


Which command properly allocates memory a) char *a=new char[20]; b) char a=new char[20]; c) char a=new char(20.0);

620


What is stack unwinding?

608


What is the difference between set and map in c++?

612


What is a dangling pointer in c++?

666


Is c# written in c++?

526


Difference between pointer to constant vs. Pointer constant

585