|
|
вернуться в форумWhy does my program get WA? Послано Savior 14 мар 2002 20:39 var i,n:byte; procedure a(g:byte); var i:byte; begin for i:=1 to g-1 do write('sin(',i,'+'); write('sin(',g); for i:=1 to g do write(')'); end; begin readln(n); for i:=1 to n-1 do write('('); for i:=1 to n-1 do begin a(i); write('+',n+1-i,')'); end; a(n); write('+1'); end. Try recursion (BTW there's a way without it but it's not like your program) :) (-) > var i,n:byte; > > procedure a(g:byte); > var i:byte; > begin > for i:=1 to g-1 do write('sin(',i,'+'); > write('sin(',g); > for i:=1 to g do write(')'); > end; > > begin > readln(n); > for i:=1 to n-1 do write('('); > for i:=1 to n-1 do > begin > a(i); > write('+',n+1-i,')'); > end; > a(n); > write('+1'); > end. Re: Why does my program get WA? Послано Yuan 15 мар 2002 11:36 where is the subtraction sign? Re: Why does my program get WA? Послано Savior 15 мар 2002 20:01 > where is the subtraction sign? OH! Thank you. I am so foolish. |
|
|