Write a fragment of code to: 1) input a floating point number. 2) use if stateme
ID: 3543281 • Letter: W
Question
Write a fragment of code to:1) input a floating point number.
2) use if statements to print an error if it above 100 or below 0.
3) cout appropriate message if the number is in AND an appropriate message if the number is out of the range. Write a fragment of code to:
1) input a floating point number.
2) use if statements to print an error if it above 100 or below 0.
3) cout appropriate message if the number is in AND an appropriate message if the number is out of the range.
Explanation / Answer
Here is how you would do it:
#include <iostream>
int main()
{
double N;
cin>>N;
if(N>100||N<0)cout<<"Error"<<endl;
else cout<<"Number is in range"<<endl;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.