kjhk
int factorial(int n) { int i; int f=1; for(i=2;i<=n;++i) f*=i; return f; }
factorial of -1
/*program to find the factorial of a given number*/ #include<stdio.h> #include<conio.h> int fact(int); void main() { int n,c; printf("\n enter the number for which you want to find the factorial"); scanf("%d",&n); c=fact(n); printf("\n the factorial of the number %d is %d",n,fact); getch(); } int fact(int n) { int k; if(n==0) return(1); else k=n*fact(n-1); return(k); }
Factorial 6 = 720
Prolog does not belong to any program, it is a programming language.
Tom Conlon has written: 'Start problem-solving with Prolog' -- subject(s): Prolog (Computer program language) 'Learning Micro-PROLOG' -- subject(s): Micro-PROLOG (Computer program language)
In prolog, you dont control the flow. The flow controls you.
Helder Coelho has written: 'Prolog by example' -- subject(s): Prolog (Computer program language)
The innovative computer program Prolog associated with artificial intelligence and computational linguistics first appeared in 1975. It was one of the first logic programming languages.
Robert M. Colomb has written: 'Implementing persistent Prolog' -- subject(s): Prolog (Computer program language)
Nigel. Ford has written: 'Javascript for the Intelligent Web Site' 'PROLOG programming' -- subject(s): Prolog (Computer program language)
Zero factorial, written as 0!, equals 1. This is a simple math equation.
Dennis Merritt has written: 'Building expert systems in Prolog' -- subject(s): Expert systems (Computer science), Prolog (Computer program language)
purpose prolog
this is a code for calculating it recursivelly: float Factorial (float n) { if (n<=1) return 1.0; else return n* Factorial(n-1); }
Fernando C. N. Pereira has written: 'Prolog and natural-language analysis' -- subject(s): Computational linguistics, Prolog (Computer program language)