DivisionFactorial-Funciones

Zaid · January 24, 2021 · C++
#include <iostream>
#include <math.h>
using namespace std;
float n,n2;
void leer(float &n, float &n2);
int factorial(int n);

int main(int argc, char *argv[]) {
	int r;
	leer(n,n2);;
	factorial(n);
	factorial(n2);
	r = factorial(n)/factorial(n2);
	cout<<r;
	return 0;
}
int factorial(int n){
	int f=1;
	for(int i=1; i<=n; i++){
		f=f*i;
	}
	return f;
}

void leer(float &n, float &n2){
	do{
		cin>>n>>n2;
	} while((n && n2)<=0);		
}

Comments

Please sign up or log in to contribute to the discussion.