Skip to main content

Posts

Showing posts from July 10, 2016

Zeros in Factorial Inside out !

Here is the C Program to generate a series which leads us to understand the number of zeros in a Factorial: -------------------------------------------------------------------------------------------------------------------------- #include <stdio.h> #include<stdlib.h> int ZerorsInFactorial(int number); int main(int argc, char **argv) { //printf("hello world\n");     //This is to see the howmany zeros will be there in a factorial , let that be P.     //The values P take as we move towards infinity     int i=0;FILE *fptr;     fptr=fopen("program.txt","w");     if(fptr==NULL){       printf("Error!");       exit(1);     }     while(i<1000)         {             fprintf(fptr,"%d zeros in %d factorial\n",ZerosInFactorial(i),i);     printf("%d zeros in %d factorial\n",ZerosInFactorial(i),i);i++;     } fclose(fptr);    // printf("Hello World"); return 0; } int ZerosInFactorial(int n