When i single click on run button in vs code it runs fine , but on double clicking the run button my program goes to infinte loop

Viewed 30
#include <stdio.h>

int main()

{
    int num, a = 0;
    printf("Enter the natural number you want to print the series to:");
    scanf("%d", &num);
    do
    {
        printf("%d \n", ++a);
    } while (a < num);
    
    return 0;
}

This is my code. On double click the run button in vs code it turns to infinite loop of printing series whereas if i run it single time by clicking once it runs fine . How is this happening. Can someone explain . I am a begineer so it might be a silly question.

0 Answers
Related