Saturday, 23 June 2012

how to find the factorial of a number using while loop in c++


how to find a factorial of a number in c++
How to find a factorial of a number in c++:- Here is the source code to find the factorial of a number using while loop in c++.It is quite simple including the body.So try it and give your feed back to me.
#include<iostream.h>
#include<conio.h>
main()
{
      int x;
      cout<<"enter the value for which you want the factorial:";
      cin>>x;
      int f=1;
      int n=1;
      while(n<=x)
      {
                 f=f*n;
                 n=n+1;
                 }
                 cout<<"this is the required value:"<<f<<endl;
                 getch();
                 }
End

6 comments:

  1. nice program , for more information you can visit http://www.tutorialworld.in/

    ReplyDelete
  2. plz explain the working of program step by step for better understanding

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. thank you for sharing nice article in your blog
    visit
    web tutorial programming


    thank you for sharing nice article in your blog
    visit
    web tutorial programming
    welookups

    ReplyDelete

  5. nice article for beginners.thank you.
    javacodegeeks

    ReplyDelete