Broken calculator

code works fine on editor but shows segmentation fault in coding blocks ide

constraints

1 < = N < = 500

will this code give correct ans for 100!?
obviously not

as 100! has 158 digits which can’t be stored in any primitive data types(int,lon g,long long int etc…)

so to solve this question you have to use arrays
store no in array and also use arrays for calculation

1 Like

thank you , that helped

1 Like