Factorial:
-factorial of number is the multiplication of every integer number between 1 and that number.
Example-
factorial of 3 is 6(1*2*3)
factorial of 5 is 120(1*2*3*4*5)
Goto:
-This statement are used to jump from one line to another line in the program.
-It is the jumping statement in C.
Syntax-
xyz:
goto xyx;
-when the execution of program are come at the goto line then it will jump to the xyz: line.
-Goto statement are also be used to make a loops.
-Goto statement are also goes in infinite loop.
program-
#include < stdio.h>
int main()
{
int n,fac=1;
printf("Enter Any Number\n");
scanf("%d",&n);
point:
fac=fac*n;
n=n-1;
if(n>0)
goto point;
printf("Factorial is %d",fac);
}
output-
Enter Any Number
5
Factorial is 120
Enter Any Number
6
Factorial is 720
-In this program, we create a loop type structure with the goto statement that are able to find the factorial of the input number.