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

Consider the following C++ program

0 Answers  


What is Copy Constructor?

5 Answers   ABC, Siemens,


Define type casting in C++.

0 Answers   Amdocs,


Can we use THIS Pointer in static function – Reason in C++?

0 Answers  


What is data abstraction? How is it implemented in C++?

0 Answers   Amdocs,






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

0 Answers   Aricent,


When would you use a pointer? A reference?

0 Answers   Amazon,


Explain the FOR loop with a help of a code.

0 Answers   Accenture,


What Are The Differences Between A C++ Struct And C++ Class?

2 Answers   Wipro,


Tell us the size of a float variable.

0 Answers   Accenture,


What are pass by value and pass by reference?what is the disadvantage of pass by value?

0 Answers   Alter,


How will you execute a stack using a priority queue? (Push and pop should be in O (1)).

0 Answers   Adobe,


Categories