|
|
back to boardWhere is wrong?(the following 3 examples are wrong answers)I don't know 1: var n,i:integer; begin read(n); writeln(0); for i:=1 to n do begin writeln('X'); writeln('*'); writeln(i); writeln('+'); end; end. 2: 2: var n,i:integer; begin n:=1000; writeln(0); for i:=1 to n do begin writeln('X'); writeln('*'); if i>=1000 then begin writeln(i mod 10);writeln(i mod 100 div 10);writeln(i mod 1000 div 100);writeln(i div 1000);end; if (i<1000)and(i>=100) then begin writeln(i mod 10);writeln(i mod 100 div 10);writeln(i mod 1000 div 100);end; if (i<100)and(i>=10) then begin writeln(i mod 10);writeln(i mod 100 div 10); end; if i<10 then writeln(i); writeln('+'); end; readln; end. 2: 2: var n,i:integer; begin read(n); writeln(0); for i:=1 to n do begin writeln('X'); writeln('*'); if i>=1000 then begin writeln(i mod 10);writeln(i mod 100 div 10);writeln(i mod 1000 div 100);writeln(i div 1000);end; if (i<1000)and(i>=100) then begin writeln(i mod 10);writeln(i mod 100 div 10);writeln(i mod 1000 div 100);end; if (i<100)and(i>=10) then begin writeln(i mod 10);writeln(i mod 100 div 10); end; if i<10 then writeln(i); writeln('+'); end; end. 3: 3: var n,i:integer; begin read(n); writeln(0); for i:=1 to n do begin writeln('X'); writeln('*'); if i>=1000 then begin writeln(i div 1000);writeln(i mod 1000 div 100);writeln(i mod 100 div 10);writeln(i mod 10);end; if (i<1000)and(i>=100) then begin writeln(i mod 1000 div 100);writeln(i mod 100 div 10);writeln(i mod 10);end; if (i<100)and(i>=10) then begin writeln(i mod 100 div 10);writeln (i mod 10); end; if i<10 then writeln(i); writeln('+'); end; end. This 2: is wrong ,the next 2 is right > 2: > var n,i:integer; > begin > n:=1000; > writeln(0); > for i:=1 to n do > begin > writeln('X'); > writeln('*'); > if i>=1000 then begin writeln(i mod 10);writeln(i mod 100 div > 10);writeln(i mod 1000 div 100);writeln(i div 1000);end; > if (i<1000)and(i>=100) then begin writeln(i mod 10);writeln(i mod > 100 div 10);writeln(i mod 1000 div 100);end; > if (i<100)and(i>=10) then begin writeln(i mod 10);writeln(i mod > 100 div 10); end; > if i<10 then writeln(i); > writeln('+'); > end; > readln; > end. |
|
|