Just put the code in a function and return 0 or 1 (dependig on the choice of the user to continue or not):
Code:
#include <stdio.h>
int do_something(void);
int main(void)
{
while(do_something());
return 0;
}
int do_something(void)
{
int start=0; /* integer for the starting number */
int end=0; /* integer for the ending number */
int i =0; /* increment counter to the value of &end */
char more; /* variable to continue with the loop y||Y */
printf(" Please enter the starting and ending values\n"); /* statement to user */
scanf(" %d" " %d", &start, &end); /* getting the values */
printf(" dec hex char \n"); /* printing the display header */
for( i = start; i <= end; ++i) /* looping through the numbers adding 1 to end */
{
printf(" %d %x %c \n", i, i, i); /*printing the values of each type */
}
printf("Would you like to try some more values? (N/Y)?: \n"); /* ask for more input values */
scanf(" %c", &more); /* look for value to be yes or no */
if(more == 'y' || more == 'Y' )
return 1; /* continue */
return 0; /* stop */
}