#include <stdio.h> #include <ctype.h> /* For tolower() function */ int main(void) { char answer = 'N'; printf("\nThis program calculates the average of any number of values."); for( ;; ) /* Indefinite loop */ { printf("Do you want to enter another value? (Y or N): "); scanf(" %c", &answer ); if( tolower(answer) == 'n' ){ break; } } return 0; }
This program calculates the average of any number of values.Do you want to enter another value? (Y o r N): N