daily pastebin goal
80%
SHARE
TWEET

Untitled

a guest Jan 19th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int fac1(int n,int cnt)
  4. {
  5.     int j=1;
  6.     if(n==cnt)
  7.         return cnt;
  8.     else
  9.         return n*fac1(n-((j++)*cnt),cnt);
  10. }
  11. int fac2(int n,int c,int cnt)
  12. {
  13.     int k=1;
  14.     if(n==c)
  15.         return c;
  16.     else
  17.         return n*fac2(n-((k++)*cnt),c,cnt);
  18. }
  19. int main()
  20. {
  21.     int a,b,c,d,e,f,g,cnt=0,i,sum=0;
  22.     char s[25];
  23.     cin>>a;
  24.     scanf("%s",s);
  25.     for(i=0;s[i]!='\0';i++)
  26.         cnt++;
  27.     c=a%cnt;
  28.     if(c==0)
  29.     {
  30.        d= fac1(a,cnt);
  31.         printf("%d\n",d);
  32.     }
  33.     else
  34.     {
  35.         e=fac2(a,c,cnt);
  36.         printf("%d\n",e);
  37.     }
  38.  
  39.     return 0;
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top