第1个回答 2008-04-03
我没重复啊!!
#include<stdio.h>
main()
{
int n,i,j;
long temp=1,sn=0;
scanf("%d",&n);
for(i=1;i<=n;i+=2)
{
for(temp=1,j=1;j<=i;j++)
temp*=j;
sn+=temp;
}
printf("%ld\n",sn);
}
第2个回答 2008-04-03
#include<iostream>
using namespace std;
int main()
{
int n;
int s=0.t=1;
cin>>n;
cout<<endl;
for(int i=1;i<n;i=i+2){
t=i*t;
s=s+t;
}
cout<<s<<endl;
}
这是C++
第3个回答 2008-04-03
#include"stdio.h"
main()
{
int n,i,j;
long temp,sn=0;
scanf("%d",&n);
for(temp=1,i=1;i<=n;i+=2)
for(j=1;j<=i;j++)
{temp*=j;
sn+=temp;
}
printf("%ld\n",sn);
}