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



Write a program to read the values a, b and c and display x, where x=a/b–c. Test the program..

Answer / 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

More C++ Interview Questions

What are the different scope C++ provide ?

0 Answers   Amdocs,


Write a program to display the following output using a single cout statement Maths=90 Physics=77 Chemistry = 69

2 Answers  


How do you work around them?

0 Answers   Amazon,


Explain why C++ is not purely Object Oriented Language

0 Answers   Aspire,


In C++ what is a vtable and how does it work?

0 Answers   Agilent,






C++ supports multiple inheritance. What is the “diamond problem” that can occur with multiple inheritance? Give an example.

0 Answers  


what do you mean by exception handling in C++?

0 Answers   Alter,


what is friend function in C++?

0 Answers   TCS,


What is the difference between creating an object, using 'new' and using 'malloc'?

3 Answers   HFG, Siemens,


What is function overloading and operator overloading in C++?

0 Answers   IBS, TCS,


To solve the 8 Queens problem, which algorithm is used?

0 Answers   Accenture,


Write a C++ Program to Find Sum and Average of n numbers using for loop.

1 Answers  


Categories