In: Computer Science
Write a C++ script to perform the following:
a.) Ask a user to enter 2 real numbers.
b.) Save the user response as a variable a and b.
c.) Display if the numbers are even or odd.
d.) Check if the number a belongs in the interval D = [10, 99],
display the output as "a is between 10 and 99" or "a is not between
10 and 99".
e.) Check if the number b belongs in the interval E = [0, 50],
display the output as "b is between 0 and 50" or "b is not between
0 and 50".
Code:
#include <iostream>
using namespace std;
int main()
{
   int a,b;
   cout<<"Enter first
Number:";         
//Taking response from the user
  
cin>>a;                              
//Storing it to variable
   cout<<"Enter Second
Number:";         //Taking
response from the user
  
cin>>b;                              
//Storing it to variable
  
if(a%2==0)                           
//if condition to check whether 'a' is even or odd
   {
       cout<<"a is a even
number:"<<a<<endl;
   }
   else
   {
       cout<<"a is a odd
number:"<<a<<endl;
   }
  
if(b%2==0)                           
//if condition to check whether b is even or odd
   {
       cout<<"b is a even
number:"<<b<<endl;
   }
   else
   {
       cout<<"b is a Odd
number:"<<b<<endl;
   }
   if(a>10 &&
a<99)                    
//condition to check 'a' is in given range or not
   {
       cout<<"a is in between
10,99"<<endl;
   }
   else
   {
       cout<<"a is not between
10,99"<<endl;
   }
   if(b>0 &&
b<50)                      
//condition to check 'b' is in given range or not
   {
       cout<<"b is in between
0,50"<<endl;
   }
   else
   {
       cout<<"b is not between
0,50"<<endl;
   }
  
}
Reference:

Output:

Note: I have provided you needed information. If face any difficulty in understanding it please comment.If you are satisfied with my answer please upvote....Thank you...