[ create a new paste ] login | about

Link: http://codepad.org/wDUVNpdl    [ raw code | output | fork ]

mohit_at_codepad - C, pasted on Apr 26:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdio.h>
#include <math.h>

int main() {
  int i = 0;
  double val100f = 1.0;
  for(i = 2; i <= 100; ++i) {
    val100f *= i;
  }
  i = 0;
  while(val100f > 1.0) {
    ++i;
    val100f /= 10.0;
  }
  printf("100! has %d digits.\n", i);
  return 0;
}


Output:
1
100! has 158 digits.


Create a new paste based on this one


Comments: