Program
Program
opasdfghjklzxcvbnmqwertyuiopasdfgh
jklzxcvbnmqwertyuiopasdfghjklzxcvb
nmqwertyuiopasdfghjklzxcvbnmqwer
tyuiopasdfghjklzxcvbnmqwertyuiopas
dfghjklzxcvbnmqwertyuiopasdfghjklzx
Data Structure and Algorithm
cvbnmqwertyuiopasdfghjklzxcvbnmq
wertyuiopasdfghjklzxcvbnmqwertyuio
pasdfghjklzxcvbnmqwertyuiopasdfghj
klzxcvbnmqwertyuiopasdfghjklzxcvbn
mqwertyuiopasdfghjklzxcvbnmqwerty
uiopasdfghjklzxcvbnmqwertyuiopasdf
ghjklzxcvbnmqwertyuiopasdfghjklzxc
vbnmqwertyuiopasdfghjklzxcvbnmrty
uiopasdfghjklzxcvbnmqwertyuiopasdf
ghjklzxcvbnmqwertyuiopasdfghjklzxc
Write a algorithm to find the factorial of a no.
Algorithm:
Start
1. First of all take variables of integer type i and n.
2. Now take a variable of integer type fac and set it as fac = 1.
3. Now initialize i as i= 1 and set it to i<=n.
4. Now set fac = fac*i.
5. And store the value in fac.
End.
Code:
#include <iostream>
int main() {
int i, n, fac=1;
cin>>n;
{ fac= fac*i; }