U E D R , A S I H C RSS

데블스캠프2013/다섯째날/구구단

No difference found



  • 형진 선배 python 코드(재귀)

def gugu(dan, i):
    print dan, i, dan*i;
    if (i < 9):
        gugu(dan, i+1);
    elif (dan < 9):
        gugu(dan+1, 1);
  • 태진&상현 C 코드 (재귀)

#include <stdio.h>

int main()
{
    int i,j;
   recur(1,1);
    return 0;
}
void recur(int i,int j)
{
    if(i==10){
        return;
    }
    recur2(i,j);
    printf("\n");
    recur(i+1,j);
}
void recur2(int i,int j)
{
    if(j==10){
       return;
    }
    printf("%dx%d = %d ",i,j,i*j);
    recur2(i,j+1);
}
  • 김민재 코드

#include <stdio.h>

void gu(int base, int inc) {
	if(base==10) {
		return;
	}
	if(inc==10) {
		printf("\n");
		gu(base+1, 1);
		return;
	}
	printf("%d x %d = %d\n", base, inc, base*inc);
	gu(base, inc+1);
}

int main(void) {
	gu(1, 1);
	return 0;
}
  • 김해천 코드

#include <stdio.h>
void printRow(int Num){
	if( Num < 81 ){
		printf("%d * %d = %d\n", (Num/9+1), (Num)%9+1 , (Num/9+1)*((Num)%9+1));
		printRow( ++Num );
	}
	return;
}
int main(){
	int inx;
	printRow(0);
	return 0;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:15
Processing time 0.0445 sec