Computer Science, asked by kavyansh306a, 9 months ago

Write a program in java to print 10 terms of series 2^n+2. Skip multiples of 3 but stop if the term is a multiple of 5 and greater than 100. ( start value of n as 3).

Answers

Answered by dshkkooner1122
0

Write a loop from 1 till the number of terms that you want

Inside the loop calculate each term as 2" + 2 based on the loop counter

You have to divide the term by 3 to see if it s a multiple of 3

If is divisible, use continue statement of Java

If it is not divisible by 3, you have to check if it is divisible by 5 and the term is greater than 100

If it is divisible by 5 and greater than 100, execute the beak statement of Java

If it is not divisible by 5 and less than 100, print the term to the console

Similar questions