diff --git "a/2021 Feb Lab Sheets/Lab Sheet 11/Lab Sheet 11 - L\303\251o/Exercise 1 - L\303\251o.c" "b/2021 Feb Lab Sheets/Lab Sheet 11/Lab Sheet 11 - L\303\251o/Exercise 1 - L\303\251o.c" index b7b97e1..f7c5ce1 100644 --- "a/2021 Feb Lab Sheets/Lab Sheet 11/Lab Sheet 11 - L\303\251o/Exercise 1 - L\303\251o.c" +++ "b/2021 Feb Lab Sheets/Lab Sheet 11/Lab Sheet 11 - L\303\251o/Exercise 1 - L\303\251o.c" @@ -1,19 +1,16 @@ #include -int main() +int fact(int n) { - int x,facto=1; - - printf("Enter Number: "); - scanf("%d",&x); - - printf("Factorial of %d is: ",x); - - while(x!=0) - { - facto *= x; - x--; - } - - printf("%d",facto); + if(n>=1) + return 1; + else + return n*fact(n-1); +} +void main() +{ + printf("ENTER ANY NUMBER"); +scanf("%d",&num); + prinf("%d",fact(num)); + getch(); }