1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vera_Pavlovna [14]
3 years ago
7

For java

Computers and Technology
1 answer:
Sedbober [7]3 years ago
8 0

Answer:

public class array{

    public static void main(String []args){

       int[] array = {2,4,7,1,9};

       int num_vals = array.length;

       for(int i=0;i<num_vals;i++){

           

           System.out.println(array[i] + " ");

       }

       for(int i=num_vals-1;i>=0;i--){

           

           System.out.println(array[i] + " ");

       }

    }

}

Explanation:

First create the class in the java programming.

Then create the main function and declare the array with values.

Store the size of array in num_vals variable by using the function array.length.

create a for loop to iterate the each element in the array and then print on the screen with spaces and newline.

it traverse the loop from first to last.

Then, again create the for loop to iterate the each element in the array and then print on the screen with spaces and newline but the traversing start from last to first.

You might be interested in
Determine if the following identifiers are valid. If they are invalid, state the reason. For example, the identifier min value i
Natasha2012 [34]

Answer:

Explanation:

Determine if the following identifiers are valid. If they are invalid, state the reason. For example, the identifier min value is invalid as it uses a whitespace.

road

mid_point

8ball

break

_log_value

EVERY1

[email protected]

_log

NewNumber

$varA

class

4 0
3 years ago
In excel, combining two or more selected cells into one cell is called ____ cells
n200080 [17]
The answer that would best complete the given statement above would be the word "MERGING". So here is the complete statement. <span>In excel, combining two or more selected cells into one cell is called MERGING cells. Hope this answers your question. Have a great day!</span>
4 0
3 years ago
Write a program with a method that plays the guess a number game. The program should allow the user to pick a number between 1 a
nlexa [21]

Answer:

Please check the explanation

Explanation:

That's the code and it is done with the program in c++ according to instructions given in the question using binary search. It can guess the correct number in 10 or fewer attempts and also shows the number of attempts it took to guess the number.

​ #include <iostream> using namespace std; int guess() { string input; int l = 1, h = 1000; int mid = (l + h) / 2, count = 0; while (1) { //count the number of attemts to guess the number ++count; //cout << count << "\n"; cout << "\n"; cout << "Is " << mid << " correct? (y/n): "; cin >> input; //if input is y print the guessed no. and return if (input == "y") { cout << mid << " guessed in " << count << " attempts!\n"; return 1; } //if input is n ask the user if it's higher or lower than current guess if (input == "n") { cout << "Is the number greater than or less than the number ? (h/l): "; cin >> input; } //if input is higher assign mid incremented by 1 to low //else decrement mid by 1 and assign to high if (input == "h") l = mid + 1; else h = mid - 1; //calculate mid again according to input by user again mid = (l + h) / 2; } } int main() { cout << "****WELCOME TO THE GUESS THE NUMBER GAME!****\n"; cout << "Guess any number between 1 to 1000.\n"; cout << "This game depends on user giving correct answers and not changing their number middle of game.\n"; guess(); } ​

8 0
3 years ago
TRUE/FALSE<br><br> The Interrupt Flag (IF) controls the way the CPU responds to all interrupts.
Nastasia [14]

Answer: True.

Explanation:

The value of the IF is very important to respond to the interrupts in the OS. It is a system flag bit. All the hardware interrupts will be handled if the flag value is set to 1 else all interrupts will be ignored. It takes two values either 1 or 0.

3 0
4 years ago
UML uses the________________ diagram to model the flow of procedureor
malfutka [58]

Answer:

A - Activity

Explanation:

UML contains multiple subdivisions of diagrams which allow you to visualize what the software will do, while activity diagrams demonstrate the process of what happens in the system being modeled. This is why UML uses the activity diagram to model the flow of procedure.

5 0
3 years ago
Other questions:
  • peter has recently bought a media player and a digital camera. he wants to buy a memory card for these devices. which memory dev
    11·1 answer
  • IN MICROSOFT EXCEL YOU CAN UES FOMULA TO DIVIDE OR MULTIPLY WHAT IS THE CORRECT FORMULA TO CALCULATE 4*6
    14·1 answer
  • What activities are the most likely to infect your computer with a virus? Check all that apply
    11·2 answers
  • Social media is a type of ___________ ccommunication (type either push or pull for your response).
    8·2 answers
  • As a consommé simmers, the meat and eggs coagulate, forming a
    6·1 answer
  • Who likes video games
    11·1 answer
  • Answer this question for points lol
    7·2 answers
  • What is the highest numeral in a binary code?
    5·1 answer
  • A keyboard would be considered _____. Select 2 options.
    13·2 answers
  • What happens if an email server cannot find a matching username or the mailbox is full
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!