Advertisement
momo2345

3 no.

Oct 3rd, 2020
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int fac(long long n,long long  r){
  4.     long long p=n-r,ans=1,ans1=1,ans2=1;
  5.     while(n>1){
  6.         ans*=n;
  7.         n--;
  8.     }
  9.     printf("%lld\n",ans);
  10.     while(r>1){
  11.         ans1*=r;
  12.         r--;
  13.     }
  14.     printf("%lld\n",ans1);
  15.     while(p>1){
  16.         ans2*=p;
  17.         p--;
  18.     }
  19.     printf("%lld\n",ans2);
  20.     long long npr=ans/ans2;
  21.     long long ncr=ans/(ans1*ans2);
  22.     printf("%lld %lld ",npr,ncr);
  23. }
  24. int main()
  25. {
  26.     long long  n,r;
  27.     scanf("%lld%lld",&n,&r);
  28.     fac(n,r);
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement