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 |
Write a C++ program to print strings in reverse order.
How do you work around them?
What is the purpose of a constructor? Destructor?
Write a program to input an integer from the keyboard and display on the screen “WELL DONE” that many times.
Without using third variable write a code to swap two numbers.
What is data abstraction? How is it implemented in C++?
What is the 4 difference between delete[] and delete?
What is an abstract class?
what do you mean by exception handling in C++?
What is static variable and difference between(const char *p,char const *p,const char* const p).
What does malloc return in C and C++?
When would you choose to return an error code rather than throw an exception?