Scanf's return value is the number of specifiers that you give it.
how can i make my program accept 2 integers and quit if it is a non - integer value. using scanf
However that still made the program terminate wrong.
while ( scanf("%d %d", &num, &num_max) == 2)
----body of code
Here is my code:
/* numberSQUARED.c shows a integer, its squared and cubbed sequence in a given length*/
#include <stdlib.h> /* system needed */
printf("Enter a min number and a max.");
scanf("%d %d", &num, &num_max);
/* format the screen */
printf("num SQUARED CUBBED\n\n");
/* output the results */
for (ndx = num; ndx <= num_max; ndx++)
printf("%d %6d %6d", ndx, ndx * ndx, ndx * ndx * ndx);