Book of tasks on programming. Old version

 

 by Aliaksandr N. Prykhodzka

 

сдвиг, диаграмма, college, examples, обзор, реассемблирование, interface, record, кобол, array, interface, and, университет, объяснения, format, visual basic
 

for valuable work you must have JavaScript (allow active content)

Java. J.4. Nest of tasks. Simple programs

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

J.4.1     Answer      Pascal-analogue

Determine a number produced by this program


import java.io.*;

public class j_0_1 {

    public static void main(String [] Args) {

    int yy = 3;
    int zz = 5;
    int xx;

    xx = yy + zz;

    System.out.print(xx);

}
}


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

J.4.2     Answer      Pascal-analogue

Determine a number produced by this program


import java.io.*;

public class j_0_2 {

    public static void main(String [] Args) {

    int yy = 4;
    int zz = 9;
    int xx;

    xx = yy + zz;

    System.out.print(xx);

}
}


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

J.4.3     Answer      Pascal-analogue

Determine a number produced by this program


import java.io.*;

public class j_0_3 {

    public static void main(String [] Args) {

    int yy = 13;
    int zz = 17;
    int xx;

    xx = yy + zz;

    System.out.print(xx);

}
}


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

J.4.4     Answer      Pascal-analogue

Determine a number produced by this program


import java.io.*;

public class j_0_4 {

    public static void main(String [] Args) {

    int yy = 3;
    int zz = 5;
    int xx;

    xx = yy + zz;
    xx = xx + zz;

    System.out.print(xx);

}
}


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

J.4.5     Answer      Pascal-analogue

Determine a number produced by this program


import java.io.*;

public class j_0_5 {

    public static void main(String [] Args) {

    int yy = 4;
    int zz = 6;
    int xx;

    xx = yy + zz;
    xx = xx + zz;

    System.out.print(xx);

}
}


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

J.4.6     Answer      Pascal-analogue

Determine a number produced by this program


import java.io.*;

public class j_0_6 {

    public static void main(String [] Args) {

    int yy = 3;
    int zz = 5;
    int xx;

    xx = yy + zz;
    xx = xx * xx;

    System.out.print(xx);

}
}


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

J.4.7     Answer      Pascal-analogue

Determine a number produced by this program


import java.io.*;

public class j_0_7 {

    public static void main(String [] Args) {

    int yy = 3;
    int zz = 5;
    int xx;

    xx = yy + zz;
    xx = xx - 2;

    System.out.print(xx);

}
}


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

J.4.8     Answer      Pascal-analogue

Determine the result of program if input are numbers 3 and 8


import java.io.*;

public class j_0_8 {

    public static void main(String [] Args)
    throws Exception {

    int xx; int yy; int zz;
    String s;
    BufferedReader br = new BufferedReader(
        new InputStreamReader(System.in, "Cp866"));

    s = br.readLine();
    yy = Integer.parseInt(s);
    s = br.readLine();
    zz = Integer.parseInt(s);

    xx = yy + zz;

    System.out.println(xx);

    }
}


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

J.4.9     Answer      Pascal-analogue

Determine the result of program if input are numbers 3 and 8


import java.io.*;

public class j_0_9 {

    public static void main(String [] Args)
    throws Exception {

    int yy; int zz;
    String s;
    BufferedReader br = new BufferedReader(
        new InputStreamReader(System.in, "Cp866"));

    s = br.readLine();
    yy = Integer.parseInt(s);
    s = br.readLine();
    zz = Integer.parseInt(s);

    System.out.println(zz);
    System.out.println(yy);

    }
}


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

J.4.10     Answer      Pascal-analogue

Determine the result of program if input are numbers 3 and 8


import java.io.*;

public class j_0_10 {

    public static void main(String [] Args)
    throws Exception {

    int yy; int zz;     String s;
    BufferedReader br = new BufferedReader(
        new InputStreamReader(System.in, "Cp866"));

    s = br.readLine();
    yy = Integer.parseInt(s);
    s = br.readLine();
    zz = Integer.parseInt(s);

    System.out.println(yy);
    System.out.println(zz);

    }
}


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

J.4.11     Answer      Pascal-analogue

Determine the result of program if input are numbers 3 and 8


import java.io.*;

public class j_0_11 {

    public static void main(String [] Args)
    throws Exception {

    int yy; int zz;
    String s;
    BufferedReader br = new BufferedReader(
        new InputStreamReader(System.in, "Cp866"));

    s = br.readLine();
    yy = Integer.parseInt(s);
    s = br.readLine();
    zz = Integer.parseInt(s);

    System.out.println(zz);
    System.out.println(yy);
    System.out.println(zz);

    }
}


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

J.4.12     Answer      Pascal-analogue

Determine the result of program if input are numbers 3 and 8


import java.io.*;

public class j_0_12 {

    public static void main(String [] Args)
    throws Exception {

    int xx; int yy; int zz;
    String s;
    BufferedReader br = new BufferedReader(
        new InputStreamReader(System.in, "Cp866"));

    s = br.readLine();
    yy = Integer.parseInt(s);
    s = br.readLine();
    zz = Integer.parseInt(s);

    xx = yy + zz;

    System.out.println(xx);
    System.out.println(xx);
    System.out.println(xx);

    }
}



 

©   Aliaksandr Prykhodzka    1993 - 2007