Answer to Question #38709 in C++ for Verasak Sitawan

Question #38709
B. Modify the InBetween program so that the user must reenter the second value so it is guaranteed to be higher than the first entered value. Save the file as InBetween2.cpp.
Expert's answer
#include <stdio.h>


int main () {
int lower, upper;

scanf("%d %d", &lower, &upper);

if ( lower > upper ) {
printf("First number has to be smaller than the second one");
return 0;
}

for (int i = lower + 1; i < upper; i++) {
printf("%d ", i);
}
printf("
");
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal