+ 1

Please may i know why is my function not working in matlab

function[count] = towers(n, frompeg, topeg, auxpeg) count=0 if (n == 1) count=count+1; fprintf('\t move disk 1 from peg %c to peg %c \n', frompeg, topeg); else towers(n-1,frompeg,auxpeg,topeg); fprintf('\t move disk %d from peg %c to peg %c \n',n,frompeg,topeg); towers(n-1,auxpeg,topeg,frompeg); end end

2nd May 2021, 12:02 PM
Jothika
Jothika - avatar
1 Réponse
+ 1
Check if the file name is the same as the function name "towers.m"
4th May 2021, 7:10 PM
zak00aria
zak00aria - avatar