Answer:
The correct code to the given question is
if ((counter % 10) == 0) // check the condition
{
System.out.println("Counter is divisible by ten: " + counter); // display
}
else // check the condition
{
System.out.println("Counter is not divisible by ten: " +counter); // display the //value
}
counter++; // increment the value of counter
Explanation:
Following are the description of code
- In the given question we have to check the condition that the given number is divisible by 10 or not .
- In the if block if the number is divisible by 10 then it print the value of number and increment the value of counter .
- In the else block if the number is not divisible by 10 then it print the value of number and increment the value of counter .
- It means the value of counter is increases in the if block as well as in the else block .So we have to remove the counter statement from there and place outside the if and else block .
Answer: c because there cant be numbers or simboles also nooooooo spaces
Explanation:
brainlyist plz
Answer:
(Assuming Java)
public ArrayList diff(ArrayList list1, ArrayList list2) {
ArrayList<Integer> union = new ArrayList<>();
for (int element : list1) {
union.add(element);
}
for (int element : list2){
if (!union.contains(element)) {
union.add(element);
}
}
return union;
}
Explanation:
Create an ArrayList that has the union of list1 and list2.
First for loop copies all elements into the union array list.
Second for loop adds all elements that are not yet in the union arraylist to the union arraylist.
(Keep in mind that I assume that you mean a mathematical union, so no duplicates. If this is not what you mean, remove the if statement in the second for loop)