Program to find the factorial of a number by while looping

Tuesday, August 11, 2020

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

#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();

}

You Might Also Like

0 Comments

Like us on Facebook

Flickr Images

Flickr Short Films