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.
1
Expert's answer
2014-01-28T10:03:33-0500
#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; }
Comments
Leave a comment