Counter Help - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Counter Help

madjmmadjm Posts: 2Member
Hey guys i love the community you guys have here !

On to the problem i have a simple little program here it repeats using a do while loop i have a counter in the loop that should be counting and displays that value when the program is stoped.
For some reason the counter is not working what am i doing wrong here is the code.[code] #include
int main()

int num1,cnt;
char repeat;
cnt = 0 ;

do {
Enter a number");

Enter a next number [y] yes or no [no]");
cnt = cnt + 1; // Here is counter //

while ( repeat != 'n');

printf("You ran the program %d",cnt);


Sign In or Register to comment.