TORONTO KIDS COMPUTER CLUB | PMCA Sunday 10:00 Java Homework 20.02.09.
17065
post-template-default,single,single-post,postid-17065,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

PMCA Sunday 10:00 Java Homework 20.02.09.

14 Feb PMCA Sunday 10:00 Java Homework 20.02.09.

Question:

Write a method that returns an array of 10 even number number by following the below stated rules:

  • If the input number is an even start from that number and print the next 10 even numbers starting from that number
  • if the input number is an odd number find the next even number and print the next 10 even numbers starting from that number

Sample Input 1:
4

Sample Output 1:
[4,6,8,10,12,14,16,18,20,22]


Sample Input 2:
5

Sample Output 2:
[6,8,10,12,14,16,18,20,22,24]


Sample Input 3:
7

Sample Output 3:
[8,10,12,14,16,18,20,22,24,26]

No Comments

Sorry, the comment form is closed at this time.