练习3

// Factorial.cpp : Defines the entry point for the console application.
/*

data:2013/10/05

auth:ljz

func:n!的非递归实现

*/

#include "stdafx.h"
#include "iostream"
using namespace std;
int Factorial(int n)
{
int sum =1;
for (int i=1;i<=n;i++)
{
sum *=i;
}
return sum;
}

int main(int argc, char* argv[])
{
int a =0;
cin>>a;
cout<<Factorial(a)<<endl;
return 0;
}

原文地址:https://www.cnblogs.com/hackerl/p/3352817.html