//FACTORIAL
//program to implement factorial of a number
#include<iostream.h
void main()
{
int number,fact=1;
cout<<"enter the number=";
cinnumber;
for(int i=1;i<=number;i++)
fact=fact*i;
cout<<"\nfactorial="<<fact;
}
The logic of the program is that we are first giving a value 1 to the factorial and then repeatedly multiplying all the numbers from 1 to the input number, to the factorial of the number by using a for loop.this is done by incrementing the value of i from 1 to the input number and then puti...
Continue reading ...