User Profile
Collapse
-
OK. Lets see if someone else can suggest a solution.... -
digit frequencies in factorial of a number
Can anyone suggest a better solution to finding the digit frequencies in factorial of a number, like
3! = 6
(0) 0 (1) 0 (2) 0 (3) 0 (4) 0
(5) 0 (6) 1 (7) 0 (8) 0 (9) 0
8! = 40320
(0) 2 (1) 0 (2) 1 (3) 1 (4) 1
(5) 0 (6) 0 (7) 0 (8) 0 (9) 0
An obvious way of... -
Its simple.
Pre-fix operations are executed before the statement in which they occur and post-fix after that statement.
initially a = 6;
a = 6;
//++a makes a = 7
//--a makes a = 6
//so here you are doing: x = a*a*a
x= ( (++a * --a) * a++);
//here a becomes 7 due to a++
This program in calculating cube of a. I'm using Dev-C++.Leave a comment:
No activity results to display
Show More
Leave a comment: