guys any idea of this equivalent c loops into pascal:
for (sum=0,i=0,j=0;i<10;i++,j+=2)
sum+=i+j;
Thank you..
james
sum := 0;
i := 0;
j := 0;
while i < 10 do begin
Inc(sum, i + j);
Inc(i);
Inc(j, 2);
end;
sum := 0; i := 0; j := 0; while i < 10 do begin Inc(sum, i + j); Inc(i); Inc(j, 2); end;
Dear Hans:
Thanks for everything, more power to you.
james.
for (sum=0,i=0,j=0;i<10;i++,j+=2)
may i ask how can i convert this to for loop in Pascal
1. sum := 0;
2. i := 0;
3. j := 0;
4. while i < 10 do begin
5. Inc(sum, i + j);
6. Inc(i);
7. Inc(j, 2);
8.end;
sum:= 0;
j:= 0;
for i:= 0 to 9 do begin
inc(sum, i+j);
inc(j, 2);
end;
inc(i); {this last inc() is just to make i end up with the same value (10) }
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.