스팀은 좋은겁니다
#include<stdio.h> int teamname(); int sum(int); int main() { int k; int j; teamname(); scanf("%d", &k); j = sum(k); printf("1부터 %d의 합은 : %d\n",k, j); return 0; } int teamname(void) { printf(" ::##==\n ::## +=\n .**# +=\n . + ** *= +\n . + *+# = :\n .*++*## ...\n *++*+.. : *..\n = ******+%@::. ...: ::\n = . ::%****#*@%#%%#%#%%%+# + ...\n## *==++#***..\n .++**:\n"); printf("팀명: S'팀\n"); printf("팀원: 서영운, 송준호, 유재범\n"); for (int i = 0; i < 40; i++) printf("#"); printf("\n"); return 0; } int sum(int n) { int a = 0; if (n == 0) { return n; } else { a += n; a += sum(n - 1); } return a; }
문제 2 ¶
header.h
#include <stdlib.h> #include <time.h> #include <stdio.h> #pragma warning(disable:4996) int teamname(void) { printf(" ::##==\n ::## +=\n .**# +=\n . + ** *= +\n . + *+# = :\n .*++*## ...\n *++*+.. : *..\n = ******+%@::. ...: ::\n = . ::%****#*@%#%%#%#%%%+# + ...\n## *==++#***..\n .++**:\n"); printf("팀명: S'팀\n"); printf("팀원: 서영운, 송준호, 유재범\n"); for (int i = 0; i < 40; i++) printf("#"); printf("\n"); return 0; } void gugu(void){ int rand_num = 0; srand((unsigned)time(NULL)); int count = 0; // 입력받은거 printf(" 숫자를 입력하세요.\n"); scanf("%d", &count); for (int k = 0; k < count; k++){ rand_num = rand() % 9 + 1; printf("%d\n", rand_num); for (int i = 1; i < 10; i++){ printf("%d * %d = %d\n", i, rand_num, i*rand_num); } } }
소스.c
#include <stdlib.h> #include <time.h> #include <stdio.h> #include "header.h" #pragma warning(disable:4996) int main() { teamname(); gugu(); return 0; }