AllInWorld99 provides a reference manual covering many aspects of web programming, including technologies such as HTML, XHTML, CSS, XML, JavaScript, PHP, ASP, SQL,FLASH, jQuery, java, for loop, switch case, if, if else, for...of, for...in, for...each,while loop, blogger tips, blogger meta tag generator, blogger tricks, blogger pagination, client side script, html code editor, javascript editor with instant output, css editor, online html editor, materialize css tutorial, materialize css dropdown list,break, continue statement, label,array, json, get day and month dropdown list using c# code, CSS button,protect cd or pendrive from virus, cordova, android example, html and css to make android app, html code play,telerik show hide column, Transparent image convertor, copy to clipboard using javascript without using any swf file, simple animation using css, SQL etc. AllInWorld99 presents thousands of code examples (accompanied with source code) which can be copied/downloaded independantly. By using the online editor provided,readers can edit the examples and execute the code experimentally.


Factorial Execution in C programming
      Factorial is a mathematical formulation. It is represented by "!" (exclamation mark). It is return the integer value.The product of all the positive integers from 1 to a given positive integer. For example(5!=1*2*3*4*5).

#include<stdio.h>           //Header Files
#include<conio.h>
#include<getch.h>
long fact(int);                 //Function Decleration
void main()            //Execution Start From here
{
 long f;
 int n;
 clrscr();
 printf("Enter the Number");
 scanf("%d",&n);
 f=fact(n);                                      
 printf("\nFactorial is = %d",f);
 getch();
}

long fact(int n)   //function Definition
{
 if(n==1)                                      
 {
  return 1;
 }
 else
 {
  return n*fact(n-1);
 }
}

Factorial Execution in Javascript

Example Program:- (Editor)


Editor is Loading...



Important Part
   Execution:-

       1st Calling   ---> 5*fact(4)  <---|    5*24

       2nd Calling  ---> 4*fact(3)  <---|    4*6

       3rd Calling   ---> 3*fact(2)  <---|    3*2

       4th Calling   ---> 2*fact(1)   ----|    2*1          Calculation start from here(bottom to top)!


Advertisement

0 comments:

Post a Comment

Total Pageviews