that_one_nigga_you_k

piramide de pascal

Jun 1st, 2023
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. long fact(long n){
  7.     if(n == 1 || n==0){
  8.         return(1);
  9.     }
  10.  
  11.  /*   else{
  12.         return(n*fact(n-1));  sementinha do mal
  13.     } */
  14.  
  15.     else{
  16.         for(int i = 1; i <= n; ++i) {
  17.             n = n*i;
  18.         }
  19.  
  20.         return(n);
  21.     }  
  22. }
  23.  
  24. long comb (int g, int e){
  25.    
  26. }
  27.  
  28. int main(){
  29.  
  30.     int l;
  31.  
  32.     cout<<"digite o numero q vc quer a fatorial: ";
  33.     cin>>l;
  34.  
  35.     cout<< "\n" << fact(l);
  36.  
  37. }
  38.  
  39.  
Add Comment
Please, Sign In to add comment