U E D R , A S I H C RSS

Code Race/2015.5.15/S'팀

스팀은 좋은겁니다
#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)


void teamname(void)
{
	printf("    ::##==\n		::## +=\n		.**# +=\n		. + ** *= +\n		. + *+# = :\n	.*++*##         ...\n		*++*+.. : *..\n		= ******+%@::. ...: ::\n		= .  ::%****#*@%#%%#%#%%%+# + ...\n##                    *==++#***..\n		.++**:\n");
	printf("팀명: S'팀\n팀원: 서영운, 송준호, 유재범\n");
	for (int i = 0; i < 40; i++)
		printf("#");
	printf("\n");
}



void gugu(void){
	int rand_num = 0, count=0;
	srand((unsigned)time(NULL));

	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 "header.h"


int main()
{
	teamname();
	gugu();
	return 0;
}


Extra



#include<stdio.h>
void teamname();
int sum(int);

int main()
{
	int k;
	teamname();
	scanf("%d", &k);
	
	printf("1부터 %d의 합은 : %d\n", k, sum(k));
	return 0;
}

void teamname(void)
{
	printf("    ::##==\n		::## +=\n		.**# +=\n		. + ** *= +\n		. + *+# = :\n	.*++*##         ...\n		*++*+.. : *..\n		= ******+%@::. ...: ::\n		= .  ::%****#*@%#%%#%#%%%+# + ...\n##                    *==++#***..\n		.++**:\n");
	printf("팀명: S'팀\n팀원: 서영운, 송준호, 유재범\n");
	for (int i = 0; i < 40; i++)
		printf("#");
	printf("\n");
}
int sum(int n)
{
	int a = 0;
	if (n == 0)
	{
		return n;
	}
	else
	{
		a += n+sum(n - 1);
	}
	return a;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:22:56
Processing time 0.0101 sec