This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(){ | |
int i; | |
printf("input num : "); | |
scanf("%d", &i); | |
if(i < 5) | |
printf("input num < 5\n"); | |
else if(i == 5) | |
printf("input num : %d\n", i); | |
else | |
printf("input bum > 5\n"); | |
return 0; | |
} |
for
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(){ | |
int i; | |
for(i = 0; i < 10; i++){ | |
printf("i : %d\n", i); | |
} | |
return 0; | |
} |
while
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(){ | |
int i=0; | |
while(i < 10){ | |
printf("i : %d\n", i); | |
i = i + 1; | |
} | |
return 0; | |
} |
array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(){ | |
int i; | |
char buf[20] = "Life is too short!"; | |
printf("%s\n", buf); | |
for(i = 0; i < 20; i++) | |
printf("%c", buf[i]); | |
printf("\n"); | |
return 0; | |
} |
pointer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(){ | |
int a = 123; | |
int *b; | |
b = &a; | |
printf("a = %d\n", a); | |
printf("&a = 0x%x\n", &a); | |
printf("b = 0x%x\n", b); | |
printf("&b = 0x%x\n", &b); | |
printf("*b = %d\n", *b); | |
return 0; | |
} |
function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int addVal(int i, int j){ | |
int sum = 0; | |
sum = i + j; | |
return sum; | |
} | |
int main(){ | |
int a, b, sum; | |
printf("input num1 : "); | |
scanf("%d", &a); | |
printf("input num2 : "); | |
scanf("%d", &b); | |
sum = addVal(a, b); | |
printf("input num1 + input num2 = %d\n", sum); | |
return 0; | |
} |
0 개의 댓글:
댓글 쓰기