do_while.c 252 字节
Newer Older
B
Ben 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include <stdio.h>

void loops(int max){
    int i=0;
    do {
        printf("Hello #%i\n", i);
        i++;
    } while (i < max);      //Note the semicolon.
}

int main(){
    loops(3); //prints three greetings
    loops(0); //prints one greeting
}