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
sesenic [268]
3 years ago
12

Java public class Odds { public static void main(String[] args) { printOdds(3); printOdds(17/2); int x = 25; printOdds(37 – x +1

); } public static void printOdds(int n) { for (int i = 1; i <= n; i++) { int odd = 2*i -1; System.out.print(odd + " "); } System.out.println(); } }
Write the output.
Computers and Technology
1 answer:
Serggg [28]3 years ago
5 0

Answer:

The output of the given program is :

1 3 5

1 3 5 7 9 11 13 15

1 3 5 7 9 11 13 15 17 19 21 23 25

Explanation:

The description of the following program can be given as:

  • In the given java program firstly we define a class that is "Odds". In this class, we define the main method. In this method, we call printOdds() function three times.  
  • In the first time calling, we pass 3 in the function parameter. So the function print 3 odd number that is 1 3 5.
  • In the second time calling, we pass value 17/2 in function parameter which is 8. So, the function print 8 odd number that is 1 3 5 7.....15
  • In third time calling we define an integer variable that is x in this variable we assign value that is 25 and call function that calculates value (37-x+1) that is 13. So, the function print 13 odd numbers that is 1 3 5 7..........25.
  • In the last, we define the printOdds() function that is outside the class that prints odd numbers.
You might be interested in
In a social networking site your personal information is listed under your inbox. home. status. profile.
Sladkaya [172]
Profile let's go with profile hope this helps
3 0
3 years ago
In the accompanying figure, the split double arrow mouse pointer____.
finlep [7]
Based on the attached figure to this question, it shows that the split double arrow mouse pointer shows the result of moving the pointer of the mouse to the boundary between the column heading A and column heading B. (This answer is based on the actual options attached to this question.)
5 0
3 years ago
Write a program that reads 20 integers from the user into an array and uses a function arrayMinimum that accepts an integer arra
neonofarm [45]

Answer:

#include <iostream>

using namespace std;

int arrayMinimum(int myArray[], int myArraySize) {

int small = myArray[0];

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

   if(myArray[i]<small){

small = myArray[i];

}

 }

 return small;

}

int main(){

   int myArray[20];

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

       cin>>myArray[i];          

   }

   cout<<"The smallest is: "<<arrayMinimum (myArray,20);

   return 0;

}

Explanation:

This solution is provided in c++

#include <iostream>

using namespace std;

This line defines the arrayMinimum function

int arrayMinimum(int myArray[], int myArraySize) {

This initializes the smallest of the array element to the first

int small = myArray[0];

This iterates through the array

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

This if condition checks for the smallest

   if(myArray[i]<small){

The smallest is assigned to the small variable

small = myArray[i];

}

 }

This returns the smallest

 return small;

}

The main method begins here

int main(){

This declares an array of 20 elements

   int myArray[20];

The following iteration allows user input into the array

<em>    for(int i =0;i<20;i++){ </em>

<em>        cin>>myArray[i];          </em>

<em>    } </em>

This calls the method and returns the minimum

   cout<<"The smallest is: "<<arrayMinimum (myArray,20);

   return 0;

}

6 0
2 years ago
Write a program to test the various operations of the class clockType
Umnica [9.8K]
The class clock type was designed to implement the time of day in a program. Certain applications, and additions to hours, minutes, and seconds, might require you to start at the time zone.
5 0
3 years ago
a machine needs a minimum of 100 sec to sort 1000 names by quicksort what is the approximate worst case time needed to sort 100
alexira [117]

Answer:

6.7seconds

Explanation:

4 0
3 years ago
Other questions:
  • To play game, go inside the Grand Theft Auto V folder and right click and runGTAVLauncher as administrator.If you get any missin
    5·1 answer
  • Which of these jobs would be most appropriate for someone who majors in computer engineering? I need the answer ASAP Helping com
    14·2 answers
  • what is the software that controls the storage, retrieval and manipulation of database stored in a database
    14·1 answer
  • Select below the Active Directory server role that provides the functions of Active Directory without the requirements of forest
    14·1 answer
  • c724 wgu True or false. A storage device consists of all the components that work together to process data into useful informati
    10·1 answer
  • What property must be set on a menu item to have the user activate that option by pressing Ctrl C on the keyboard
    11·1 answer
  • Which of the following best describes the basic purpose of the internet?
    11·1 answer
  • Whats yall favv scary movie
    11·1 answer
  • Explain why regular system cleanup is vital to ensuring the operating system runs efficiently. ?
    15·1 answer
  • The RGB value below produces a shade of purple. What does the number 175
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!