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 a COPY CONSTRUCTOR and when is it called?
What are "pure virtual" functions?
0 Answers Adobe, Alter, iNautix,
What is the difference between member functions and static member functions?
Can we call a virtual function from a constructor?
Write a C++ Program to Reverse a Number using while loop.
What is partial specialization or template specialization?
When must you use a constructor initializer list?
Write a C++ Program to Check Whether a character is Vowel or Consonant.
How do you work around them?
What is an algorithm (in terms of the STL/C++ standard library)?
There is a base class sub, with a member function fnsub(). There are two classes super1 and super2 which are sub classes of the base class sub.if and pointer object is created of the class sub which points to any of the two classes super1 and super2, if fnsub() is called which one will be inoked?
what is the difference between a pointer and a reference?
0 Answers Amazon, Blue Star, C DAC,