Write a program that outputs n numbers from two sequences turn by turn and each number in its own line (2*n numbers in total). The first sequence is a, a+2, a+4, ... and the second b, b+5, b+10, ... Variables n, a and b have already been declared and should be used in your program code. For example if a = 4 and b = 7, the program should output:
4
7
6
12
8
17
...
Do not write main method. Just the necessary code lines
import java.util.Random;
public class Test{
public static void main(String[] args){
Random r = new Random();
r.setSeed(Long.parseLong(args[0]));
int n = r.nextInt(100) + 100;
int a = r.nextInt(20) + 10;
int b = r.nextInt(20) + 10;
The answer to the question is available in the PDF file https://assignmentexpert.com/https://assignmentexpert.com/homework-answers/programming-answer-35714.pdf
Comments
Leave a comment