Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- typedef int NrMare[1010];
- NrMare fact;
- void AtribMic(NrMare x,int n)
- {
- x[0]=0;
- if(n==0)
- x[(x[0]=1)]=0;
- else
- for(;n;n/=10)
- x[++x[0]]=n%10;
- }
- void ProdusMic(NrMare x,int n)
- { ///x <- x*n
- int i,t=0;
- for(i=1;i<=x[0];i++,t/=10)
- {
- t+=x[i]*n;
- x[i]=t%10;
- }
- for(;t;t/=10)
- x[++x[0]]=t%10;
- }
- int Divide(NrMare x,int n)
- { ///x = x /n, returneaza x%n
- int i,r=0;
- for(i=x[0];i>0;i--)
- {
- r=10*r+x[i];
- x[i]=r/n;
- r%=n;
- }
- for(;x[x[0]]==0 && x[0]>1;)
- x[0]--;
- return r;
- }
- void Afisez(NrMare x)
- {
- for(int i=x[0];i>0;--i)
- cout<<x[i];
- }
- int main()
- {
- int n;
- cin>>n;
- AtribMic(fact,1);
- for(int i=2;i<n;++i)
- ProdusMic(fact,i);
- Divide(fact,2);
- Afisez(fact);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement