menu search
person
Write a program in C++, to find factorial of a given number using function void
thumb_up_alt 0 like thumb_down_alt 0 dislike
3 views

1 Answer

 
verified

#include <iostream>

#include <conio.h>

using namespace std;


void fact(int num); 

int main(void)

{

   int num;

    cout<<"Enter the number to find factorial\n";

    cin>>num;

    fact(num);

    getch();

    return 0;

}

void fact(int num)

{

    int i,f=1;

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

    {

   f=f*i;

     }

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

    

}


Output::

thumb_up_alt 0 like thumb_down_alt 0 dislike

Related questions

thumb_up_alt 0 like thumb_down_alt 0 dislike
2 views 1 answer
thumb_up_alt 0 like thumb_down_alt 0 dislike
84 views 1 answer
thumb_up_alt 0 like thumb_down_alt 0 dislike
258 views 1 answer
thumb_up_alt 0 like thumb_down_alt 0 dislike
6 views 1 answer
...