1.

Write a C++ program to find the factorial of a given number? 

Answer»

#include<iostream.h>

#include<iomainp.h>

Void main()

{

int n,i,fact=1;

count<<"Enter the number to find its factorial"<<endl;

cin>>n;

for(i=1;i<=n;i++)

fact=fact*i

cout<<"The factorial of"<<n<<"is"fact<<endi;

}



Discussion

No Comment Found

Related InterviewSolutions