Wap in java to complete the following (16*1) +(14*2) +(12*3) +(10*4) +(8*5) +(6*6) +(4*7)
1 answer:
Answer:
It goes like:
public class Program
{
public static void main(String[] args)
{
int j=18;
int sum=0;
for (int i =1; i<7; i++)
{
sum=sum+(i*(j-2));
j=j-2;
}
System.out.println(sum);
}
}
Explanation:
<u>Variables used: </u>
j : controls the first number in product and decreases by 2 each time the loop runs.
sum: saves the values of addition as the loop runs.
You might be interested in
The answer is A. Brand contact.
Answer:
A
Explanation:
Integer because it contains digits that can undergo calculation within the memory
Answer:
B. lowering cholesterol
Explanation:
Edge 2021, made a 100 on the quiz. Good luck :)
Answer:
integer
Explanation:
this data type must be a number, but it will always be a whole number, so boolean is not appropriate. This means that it will be integer data type
Programming languages im pretty sure