Jump to content
Fórum Script Brasil
  • 0

ajuda em teste de mesa, duvida com função!


Question

Bom galera, eu estava tentando resolver um teste de mesa neste código abaixo:

#include <iostream>
#include <functional>

using namespace std;

int z(int x){
     if(x==0 or x==1)
        return 1;
        else
            return x*z(x-1);

}
int main(){
   int i =3, j=6;

   cout << "z="<<z(i)+ z(j)<<endl;

}
Eu não estou entendendo porque o 'Z' no final é igual a 726, segundo a compilação que fiz aqui, por favor alguém poderia esclarecer o que devo fazer, grato desde já. 

Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      148691
    • Total Posts
      644530
×
×
  • Create New...