Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Factorial of a given number...

Simplest factorial program,use of one for loop . Program designed in simple logic so enjoy...
User can enter any desire valid input for the factorial output..



Source Code:-

#include<iostream.h>
#include<conio.h>
void main()
{  clrscr();
    float n,i;
    float a=1;
    cout<<"Program for Factorial of any Number (by: Tarun Rawat)\n\n";
    cout<<"enter a value ";
    cin>>n;
    for(i=1;i<=n;i++)
       {a=a*i;}
    cout<<"factorial is "<<a;
    getch();
}

No comments:

Post a Comment

Blogger Widgets

Find Us On Google, Just type - way2cplusplus -

If you have any questions on implementing or understanding this C++ Program , shoot me a comment and I'll be glad to help! :) :)