Presentation is loading. Please wait.

Presentation is loading. Please wait.

Main() { int fact; fact = Factorial(4); } main fact.

Similar presentations


Presentation on theme: "Main() { int fact; fact = Factorial(4); } main fact."— Presentation transcript:

1 main() { int fact; fact = Factorial(4); } main fact

2 n 4 int Factorial(int n) { if (n == 0) return (1); else
return (n * Factorial(n-1)); } main Factorial n 4

3 n 3 int Factorial(int n) { if (n == 0) return (1); else
return (n * Factorial(n-1)); } main Factorial Factorial n 3

4 n int Factorial(int n) { if (n == 0) return (1); else
return (n * Factorial(n-1)); } main Factorial Factorial Factorial Factorial Factorial n

5 1 n 1 int Factorial(int n) { if (n == 0) return (1); else
return (n * Factorial(n-1)); } 1 main Factorial Factorial Factorial Factorial n 1

6 1 n 2 int Factorial(int n) { if (n == 0) return (1); else
return (n * Factorial(n-1)); } 1 main Factorial Factorial Factorial n 2

7 2 n 3 int Factorial(int n) { if (n == 0) return (1); else
return (n * Factorial(n-1)); } 2 main Factorial Factorial n 3

8 6 n 4 int Factorial(int n) { if (n == 0) return (1); else
return (n * Factorial(n-1)); } 6 main Factorial n 4

9 main() { int fact; fact = Factorial(4); } 24 main fact


Download ppt "Main() { int fact; fact = Factorial(4); } main fact."

Similar presentations


Ads by Google