26 lines
530 B
Text
26 lines
530 B
Text
/* Test read/write native functions */
|
|
class Main {
|
|
void main() {
|
|
int r1, r2, readvar, a1;
|
|
|
|
r1 = 6;
|
|
/* r2 = 22 */
|
|
r2 = read();
|
|
|
|
write(r1); writeln(); // 6
|
|
|
|
/* test expressions inside write() */
|
|
write(r1 - 3); writeln(); // 3
|
|
write(r1 - 6); writeln(); // 0
|
|
write(r1 - 7); writeln(); // -1
|
|
/* should output 111 */
|
|
readvar = read(); // 1
|
|
write( (r1 + (r2 * 5)) + readvar); // 117
|
|
write(- r1); // -6
|
|
writeln();
|
|
/* should output 15 */
|
|
a1 = read(); // -15
|
|
write(- a1); // 15
|
|
|
|
}
|
|
}
|