Skip to main content
Known Participant
May 21, 2014
Answered

Hi there

  • May 21, 2014
  • 3 replies
  • 421 views

This is my code, nothing happens at the output.

What did i do wrong.

No syntax error and no debug pb.

Tks a lot.

var n1:int;

var n2:int;

var reponse:int;

function pgcd(a:int,b:int):int

{

  if (b==0)

  {

  return a;

  }

  else

  {

  return pgcd(b, a % b);

  }

}

n1 = 27;

n2 = 18;

reponse = pgcd(n1,n2);

trace("Le PGCD de " + n1 + " et de " + n2 + " est " + reponse + ".");

This topic has been closed for replies.
Correct answer Ned Murphy

The trace output only displays in the Flash Output display panel when testing in Flash.  If you want something to appear in the Flash movie you need to make it that way.  Try adding a textfield and assign the intended result to that.

3 replies

robdillon
Participating Frequently
May 21, 2014

I got the same thing as Ned. Are you looking for output from "Test Movie" or when running a published movie?

ORDIYOHAuthor
Known Participant
May 21, 2014

When running a published movie, yes.

Ned Murphy
Legend
May 21, 2014

When I run it get :

Le PGCD de 27 et de 18 est 9.

traced in the output

ORDIYOHAuthor
Known Participant
May 21, 2014

Tks Ned.

Amy Blankenship
Legend
May 21, 2014

This looks like it might just never reach a point where b=0, so it recurses forever.