Write a program that reads three numbers and prints "increasing" if they are in increasing order, "decreasing" if they are in decreasing order, and "neither" otherwise. here, "increasing" means "strictly increasing", with each value larger than its predecessor. the sequence 3 4 4 would not be considered increasing

Respuesta :

You could assign values to variables and break it up into if else-if else statements.

Pseudocode:

if a < b and b < c:
    print("increasing")

else if a > b and b > c:
    print("decreasing")

else:
    print("neither")

Hope this helps.

Following are C++ programs to input value and print the message.

Program Explanation:

  • Defining header file.
  • Defining the main method.
  • Defining integer variable "a,b,c" that uses the input method to the input value.
  • Defining if block that checks first variable value is less than second and third value, if it's true it will print "increasing" as a message.
  • Defining else if block that checks second variable value is greater than first and third value, if it's true it will print "decreasing" as a message.
  • In the else block, it will print the "neither" as a message.

Program:

#include <iostream>//header file

using namespace std;

int main()//main method

{

   int a,b,c;//defining integer variable

   cout<<"Enter numbers: "<<endl;//print message

   cin>>a>>b>>c;//imput value

   if (a < b && a < c)//using if block that check first variable value is less than second and third value

   {

   cout<<"increasing";//print message

   }

   else if(b>a&&b>c)//using else if block that check second variable value is greater than first and third value

   {

   cout<<"decreasing";//print message

   }

   else//else block

   {

   cout<<"neither";//print message

   }

   return 0;

}

Output:

Please find the attached file.

Learn more:

brainly.com/question/13143685

Ver imagen codiepienagoya
Q&A Education