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 |
What is the difference between an ARRAY and a LIST in C++?
What do you know about Volatile keyword in C++? Explain with an example code.
Explain the difference between method overriding and method overloading in C++?
In C++ what is a vtable and how does it work?
Write a program that ask for user input from 5 to 9 then calculate the average
How many times will this loop execute? Explain your answer.
Find the Factorial of a number using a program.
Define namespace.
Discuss about iteration statements in C++ .
Write a program to display the following output using a single cout statement Maths=90 Physics=77 Chemistry = 69
Consider the following C++ program
Define an Abstract class in C++?