I learned the 'for' and 'while' repeated statement which is used to repeatedly command a particularly actions.
1. 'For' statement
This iteration operates the action code while satisfying the conditional expression from the initial condition of the variable.
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int i;
for (initial variable; repeated condtion, incremental conditon) {
Action code;
}
return 0;
}
2. 'While' statement
This iteration is repeated if the content of the conditional expression is true.
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int i;
while (conditon) {
Action code;
}
return 0;
}
'Study Meeting > 빡공단 30기' 카테고리의 다른 글
[Day 15] How to use one-dimensional array (0) | 2023.01.17 |
---|---|
[Day 14] 'Number Baseball Game' in C Programming (2) | 2023.01.16 |
[Day 12] Conditional Statement 2: switch - case (0) | 2023.01.12 |
[Day 11] Conditional Statement 1: if and else (0) | 2023.01.11 |
[Day 10] Operator 3: Bitwise Shift Operator (0) | 2023.01.11 |