Factorial Program in C++ | C++ Program to find factorial of a number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream.h> | |
#include<conio.h> | |
class Temp{ | |
public: | |
Fact() | |
{ | |
int num,fact=1; | |
cout<<"Enter the number to find out Factorial! "; | |
cin>>num; | |
for(int i=num;i>0;i--) | |
fact=fact*i; | |
cout<<"Factorial is "<<fact; | |
} | |
}; | |
void main() | |
{ | |
Temp obj; | |
obj.Fact(); | |
} |
No comments:
Post a Comment