Please help - how to quit a program
hello,
i am making this program. it reads in a number from the user then asks them if they want to enter another number, i want this repeat until the user says no, i used a do while loop but i can't get it working. please help.. the code is as follows:
thanks for any help
Code:
#include <stdio.h>
main()
{
int temp = 0;
int temptotal = 0;
char quit = 'y';
do
{
printf("Please enter the temperture:\n");
scanf("%d", &temp);
temptotal = temptotal + temp;
printf("Would you like to enter another temperture (y for yes / n for no)?\n");
scanf("%c", &quit);
} while (quit != 'n');
}