15. Write a Algorithm and Program to calculate factorial of an integer.
Algorithm:
Input
1) n
Output:
1)fact
Method
1.Start
2.Read n
3.print n
4. //logic
fact=1;
for(i=1;i<=n;i++)
begin
fact=fact*i;
end;
5.print "factorial=",fact;
6.stop
Algorithm:
Input
1) n
Output:
1)fact
Method
1.Start
2.Read n
3.print n
4. //logic
fact=1;
for(i=1;i<=n;i++)
begin
fact=fact*i;
end;
5.print "factorial=",fact;
6.stop
No comments:
Post a Comment