Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- long fact(long n){
- if(n == 1 || n==0){
- return(1);
- }
- /* else{
- return(n*fact(n-1)); sementinha do mal
- } */
- else{
- for(int i = 1; i <= n; ++i) {
- n = n*i;
- }
- return(n);
- }
- }
- long comb (int g, int e){
- }
- int main(){
- int l;
- cout<<"digite o numero q vc quer a fatorial: ";
- cin>>l;
- cout<< "\n" << fact(l);
- }
Add Comment
Please, Sign In to add comment