Write a program to find factorial of a number??
# include <iostream.h>
# include <conio.h>
int main()
{
int Number, Factorial_Result, loop_v;
Factorial_Result=1;
cin>>Number;
for(loop_v=1;loop_v<=Number;loop_v++)
{
Factorial_Result=Factorial_Result*loop_v;
}
cout<<Factorial_Result;
return 00;
}
Output:
5
120
# include <iostream.h>
# include <conio.h>
int main()
{
int Number, Factorial_Result, loop_v;
Factorial_Result=1;
cin>>Number;
for(loop_v=1;loop_v<=Number;loop_v++)
{
Factorial_Result=Factorial_Result*loop_v;
}
cout<<Factorial_Result;
return 00;
}
Output:
5
120
No comments:
Post a Comment