google search

Popular Posts


Welcome to BCA Notes

>>>>>>>>>>>>>>>>

Visitors

Search This Blog

Blogger templates

Visitor Map


Wednesday, 26 February 2014

code using object and class to find factorial of any number using c++

#include<iostream.h>
class factorial
{
 public:
 int count,n,fact;
 public:
 void fun()
 {
  cout<<"Enter The No. :\n";
  cin>>n;
  count=1;
  fact=1;
  while(count!=n)
  {
   count++;
   fact = fact * count;
  }
  cout<<"Factorial Value is :\n"<<fact<<endl;
  
 }
};
main()
{
 class factorial f1;
 f1.fun();
 
 
}

0 comments:

Post a Comment