Using a while loop

Tuesday, October 14, 2014
/* 0705.c: Using a while loop */
#include <stdio.h>

main()
{
    int c;

    c = ' ';
    printf("Enter a character:\n(enter x to exit)\n");
    while (c != 'x') {
    c = getc(stdin);
    putchar(c);
    }
    printf("\nOut of the while loop. Bye!\n");
    return 0;
}

Copyright @ 2015 Tron!

Labels

Blog Archive