Math, asked by sharadskn8790, 11 months ago

Write a function fact (int n) to find the factorial of a number n. Include a main class to find the value of s = n! /m! (n-m)!

Answers

Answered by Anonymous
1

Step-by-step explanation:

#include<iostream.h>

#include<conio.h>

void fact(int n, int &facto)

{

int i;

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

       facto*=i;

}

void main()

{

clrscr();

int n,m,fn,fm,a,fa,s;

fn=fm=fa=1;

cout<<"Enter a number : ";

cin>>n;

cout<<"Enter a number : ";

cin>>m;

fact(n,fn);

fact(m,fm);

a=n-m;

fact(a,fa);

s=fn/(fm*fa);

cout<<" Factorial of "<<n<<" = "<<fn<<'\n';

cout<<" Factorial of "<<m<<" = "<<fm<<'\n';

cout<<" Factorial of "<<a<<" = "<<fa<<'\n';

cout<<" s = "<<s<<'\n';

getch();

}

Read more on Brainly.in - https://brainly.in/question/8307674#readmore

Similar questions