dWhay my code did not work?
var a,b,c,d,e,f,g,h:integer;
begin
readln(a,b,c);
readln(d,e,f);
g:=a+b+c;
h:=d+e+f;
if g=h then writeln('NE')
else
writeln('DA');
readln;
end.
http://www.z-trening.com/new/www/html/submit.php?subm_stat=1&submit=7100053385
fbecause your algorithm is wrong...
Ntry this example:
4 7 10
3 5 19
well, in this case output should be "NE" but your code will output "DA". here's a hint.sort the lengths of the first box(a,b,c) and then the second box(d,e,f). then compare each length of the first box with the corresponding length of the second box( a with d, b with e, c with f). YOU MUST SORT THEM FIRST AND THEN COMPARE THEM. i hope you understood what i tried to tell you... :)
mit should be NE
4 7 10
3 5 19
because :
4>3,7>5 and 10<19
dIn pascal don't have sort.
u pascalu nema sort.
pYou should learn some simple sort algorithm then, like Bubble Sort.
ATry to google sorts like Bubble, Insertion, Selection.
Lhttp://www.youtube.com/watch?v=myKlT30nl5Y
Alogirtam koji sortira brijeve (među najpopularnijim algoritmima za sortiranje)
mhttp://www.youtube.com/watch?v=vxENKlcs2Tw
Quick Sort vs. Bubble Sort