Read in value with do while loop - C Statement

C examples for Statement:do while

Description

Read in value with do while loop

Demo Code

#include <stdio.h>
int main(void)
{
    const int secret_code = 13;
    int code_entered;
    /* w  ww  . j a v a  2 s . co m*/
    do
    {
        printf("Guess a number: ");
        scanf("%d", &code_entered);
    } while (code_entered != secret_code);
    printf("from boo k 2s.com!\n");
    
    return 0;
}

Result


Related Tutorials