Write a Program in C++ to find the factorial of any positive integer number.
# include<iostream.h># include<conio.h>void main (){int num,fact =1, i;clrscr();cout<<"Enter a number\n";cin>>num;for(i=1;i<=num;i++)fact=fact*i;cout<<"factorial of " << num <<" is " << fact;getch();}
Output--
Enter a number7factorial of 7 is 5040
Very useful
ReplyDeletePost a Comment