// rr.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include<stdio.h>
int sum1(int n)
{
	if(n==1)return 1;
	return sum1(n-1)*n;
}

int sum2(int n)
{
	int i,sum=0;
	for (i=1;i<=n;i++)
		sum*=i;
	return sum;
}


int main(int argc, char* argv[])
{
	int n;
	while(true)
	{
		printf("n=");
		scanf("%d",&n);
		printf("用递归法求阶乘=%d\n",sum1(n));
		printf("用循环法求阶乘=%d\n",sum2(n));
	}
	
	return 0;
}