Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

you are to write a C++ program to do the following: 1) Prompt the user to enter

ID: 3867266 • Letter: Y

Question

you are to write a C++ program to do the following:

1) Prompt the user to enter five different integers a, b, c, d, e

2) If a>b and bd and d

3) If ac and ce, print “You have entered an increasing zig-zag set of numbers”

4) If the numbers entered do not satisfy 2 or 3 above, echo the numbers by printing on one line: “The numbers you entered are: . . . . . “, where . . . . . are the five numbers entered

5) Print “The smallest of the numbers you entered is xxx”, where xxx is the smallest of the numbers

6) Print “The largest of the numbers you entered is yyy”, where yyy is the largest of the numbers

7) Print “The average of the numbers you entered is zzz”, where zzz is the average of the numbers

Note that steps 5, 6, and 7 above apply in all cases, while step 4 only applies if user does not enter an

"increasing" or "decreasing" zig-zag set of numbers. You will find the C++ logical AND operator (&&) useful for the program.

Explanation / Answer

#include<iostream>

int a,b,c,d,e;

cout << "Please Enter the numbers"<< endl;

cin >> &a,&b,&c,&d,&e ;

if ((a>b)&&(b*d)&&d){
}

elseif ((a*c)&&(c*e)){
cout << “You have entered an increasing zig-zag set of numbers” <<endl;
}

else{
cout <<“The numbers you entered are: %d %d %d %d%d “<<a,b,c,d,e;
}

int Greater,Smaller;

if(a>b && a>c && a>d && a>e){
Greater=a;
}

if(b>a && b>c && b>d && b>e){
Greater=b;
}

elseif(c>a && c>b && c>d && c>e){
Greater=c;
}

elseif(d>a && d>b && d>c && d>e){
Greater=d;
}

else{
Greater=e;
}

if(a<b && a<c && a<d && a<e){
Smaller=a;
}

if(b<a && b<c && b<d && b<e){
Smaller=b;
}

elseif(c<a && c<b && c<d && c<e){
Smaller=c;
}

elseif(d<a && d<b && d<c && d<e){
Smaller=d;
}

else{
Smaller=e;
}


cout << "The Greater of the numbers you entered is: %d" << Greater <<endl;
cout << "The smallest of the numbers you entered is: %d" << Smaller <<endl;
cout << "The Average of the numbers is : %f" << (a+b+c+d+e)/5 <<endl;