For and while loops allow a code block to be executed a certain number of times. A for loop is most often used when the number of iterations is known beforehand, while a while loop will run until a certain condition is met. Both loops are important tools when programming, as they allow for efficient and concise code.
#include <stdio.h>
// For Loop
int main() {
for (int i = 0; i <= 10; i++){
printf("%d\\n", i);
}
printf("딱 10cm 만\\n");
}
#include <stdio.h>
// While Loop
int main() {
int five = 5;
while (five <= 10){
printf("The Number is %d\\n ", five);
five++;
}
}