#include <stdio.h>int fact(int n){ if(n<2) { return n; } else { return n*fact(n-1); }}int main(){int n,i,j;scanf("%d",&n);for(i=1;i<=n;i++){ printf("%d! = ",i); for(j=1;j<=i;j++) { if(j!=i) printf("%d x ",j); else printf("%d ",j); } printf("= %d\n",fact(i));}return 0;}
No comments