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
#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 ? | 2 Yes | 5 No |
If class D is derived from a base class B
What is a COPY CONSTRUCTOR and when is it called?
Write a program to input an integer from the keyboard and display on the screen “WELL DONE” that many times.
What is name mangling/name decoration?
write a program To generate the Fibonacci Series.
What is the difference between creating an object, using 'new' and using 'malloc'?
Tell us the size of a float variable.
Can we call a virtual function from a constructor?
What is a virtual function in C++?
What is a virtual base class?
How do you write a function that can reverse a linked-list in C++?
Identify the errors in the following program. #include <iostream> using namespace std; void main() { int i=5; while(i) { switch(i) { default: case 4: case 5: break; case 1: continue; case 2: case 3: break; } i-; } }