Trending This Week:

test

Post Top Ad

Your Ad Spot

Friday, June 10, 2022

C program to find factorial of a number taking input from user.



 C program to find factorial of a number taking input from user.


#include <iostream>

using namespace std;


int main() {

    

    int n,f,i,ans;

    cout<<"Enter Number : ";

    cin>>n;

    f=n;

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

    {

        f=f*i;

    }

    cout<<"Factorial is : "<<f;

    return 0;

}


No comments:

Post a Comment

Post Top Ad

Your Ad Spot