Pascal:
var p:array[1..15] of integer;
i:integer;
begin
for i:=1 to 15 do
p[i] := random(31);
if p[i] < 7 then
p[i] := p[i] * 2;
write(p[i], ' ');
end;
end.
Java:
package com.znanija
import java.util.Random;
public class Main {
public static void main(String[] args) {
Random rand = new Random();
int[] p = new int[15];
for (int i=0;i<15;i++) {
p[i] = rand.nextInt(31);
if (p[i] < 7)
p[i] *= 2;
System.out.print(p[i] + " ");
}
Pascal:
var p:array[1..15] of integer;
i:integer;
begin
for i:=1 to 15 do
begin
p[i] := random(31);
if p[i] < 7 then
p[i] := p[i] * 2;
write(p[i], ' ');
end;
end.
Java:
package com.znanija
import java.util.Random;
public class Main {
public static void main(String[] args) {
Random rand = new Random();
int[] p = new int[15];
for (int i=0;i<15;i++) {
p[i] = rand.nextInt(31);
if (p[i] < 7)
p[i] *= 2;
System.out.print(p[i] + " ");
}
}
}