Variants
Views
Actions

Cppreference:Archives

From cppreference.com
Revision as of 04:01, 16 January 2020 by 213.233.108.202 (Talk)


  1. include <iostream>

using namespace std; int main() { int i, factn=1, n, k, factnk=1, comb; cout<<"n="; cin>>n; cout<<"k="; cin>>k; if(n<k){ cout<<"Nu exista factorial!";} else{

for(i=1;i<=n;i++){ factn=factn*i; }

for(i=1; i<=n-k; i++){ factnk=factnk*i; }


if(n!=0) { comb=factn/factnk; } cout<<"Permutari de "<<n<<" luate cate "<<k<<" = "<<comb; } }