



















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




















main () { int a=15; int b=5; int c; c = a + b; } 0 15 a 1 5 b 2 0 c 3 begin 4 .c = a +b 5 load M(0) 6 add M(1) 7 stor M(2) 8 halt
0 15 1 5 2 a 3 b 4 c 5 begin
main () { int a=15, b=5, c; if (a >= b) c = a – b; else c = a + b; } 0 15 a 1 5 b 2 c 3 begin
main () { int a=15, b=5, c; if (a > b) c = a – b; else c = a + b; } 0 15 a 1 5 b 2 c 3 1 4 begin
main () { int x=0; while (x < 5) { x=x+1;//or ++x; } } A NOTE FOR HOMEWORK You CAN NOT change a top testing loop to a bottom testing loop! 0 5 1 1 2 0 x 3 begin
main () { int I , x = 0; for (I =1;I<=6; ++I) { if (I % 2==0) { // % is mod, so I mod 2 x = x +I; } } x = x * 2; }
0 7 1 1 2 2 3 i 4 0 x 5 begin