Program to find the factorial of a number by while looping

C++ is one of the most popular programming languages. It is based on C but is an object-oriented programming language. It is widely used in graphics libraries, games, network devices, etc.
Program to find Factorial of a number by while looping
//Program to find Factorial of a number by while looping
#include<iostream.h>
#include<conio.h>
#include<math.h>
 void main()
{clrscr();
 int num,fact=1;
 cout<<"\n Enter the number:";
 cin>>num;
 for(int i=1;i<=num;i++)
 {
  fact=fact*i;
 }
 cout<<"\n Factorial of "<<num<<"="<<fact;
 getch();
}
Program to find the factorial of a number by while looping Program to find the factorial of a number by while looping Reviewed by SHERE KHOJRAHA on February 13, 2019 Rating: 5

No comments:

Powered by Blogger.