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

Is there a difference between class and struct?

0 Answers  


What is a memory leak in C++?

0 Answers   Agilent,


Write a C++ Program to find Addition of Two Numbers.

1 Answers  


What is name mangling/name decoration?

0 Answers   Amazon,


What is RTTI and why do you need it?

0 Answers   Amazon,






What is pass by value & reference.

0 Answers   Accenture,


What is Coupling?

0 Answers   Cap Gemini,


How to input string in C++

0 Answers  


In C++ what is the meaning of data hiding?

0 Answers   Aricent,


Difference between Call by pointer and by reference.

0 Answers   Adobe,


How to run C++ program in cmd

0 Answers  


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

0 Answers  


Categories