#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
int age = 10;
if(age > 10){
printf("10보다 큽니다.\n");
}else if(age == 10){
printf("10입니다.\n");
}else{
printf("10보다 작습니다.\n");
}
//and or not && || !
//a>=4 && a!=5 a가 4보다 크거나 같으면서 a는 5랑 다르다.
//a == 3 || a >= 7 a는 3이랑 같거나 a는 7보다 크거나 같다.
//a == 4 ! a == 3 a가 4랑 같지 않으면서 a가 3이랑 같지 않다.
int i=0;
for(i=0; i<10; i++){
if(i==5){
break;
}
printf("%d번 학생\n", i);
}
printf("--------------------\n");
for(i=0;i<10;i++){
if(i==5){
continue;
}
printf("%d번 학생\n", i);
}
srand(time(NULL)); //난수초기화
rand() % 10; //0부터 9까지
rand() % 10+1; //1부터 10까지
printf("%d\n", rand() % 10);
printf("%d\n", rand() % 10+1);
int j = 1;
switch(j){
case 1:
printf("콜라입니다.");
break;
case 2:
printf("곰젤리입니다.");
break;
default:
printf("기본");
break;
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: