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
aleksandr82 [10.1K]
3 years ago
11

Consider the following code segment.

Computers and Technology
1 answer:
Bingel [31]3 years ago
3 0

Answer:

A.)

arr[0] = 10;

arr[1] = 10;

Explanation:

Given the array:

arr = {1,2,3,4,5}

To set the first two elements of array arr to 10.

Kindly note that ; index numbering if array elements starts from 0

First element of the array has an index of 0

2nd element of the array has an index of 1 and so on.

Array elements can be called one at a time using the array name followed by the index number of the array enclosed in square brackets.

arr[0] = 10 (this assigns a value of 10 to the index value, which replace 1

arr[1] = 10 (assigns a value of 10 to the 2nd value in arr, which replaces 2

You might be interested in
What type of maintenance is required of a computer’s power supply to ensure that it remains in working order?
True [87]
<span>d. Clean any dust or debris from the air vents in front of the fans.</span>
5 0
3 years ago
Read 2 more answers
Define a method printFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. End with a n
worty [1.4K]

Answer:

The program to this question as follows:

Program:

//header file

#include <iostream> //defining header file

using namespace std;

void printFeetInchShort(int numFeet,int numInches); //decalring method printFeetInchShort  

void printFeetInchShort(int numFeet,int numInches)//defining method printFeetInchShort

{

cout<<"height: "; // print message

cout<<numFeet<<"\'"<<""<<numInches<<"\""; //print value

}

int main() //defining main method

{

int numFeet, numInches; //defining integer variable

cout<<"Enter height feet: "; //print message

cin>>numFeet; //input value by user

cout<<"Enter height inches: "; //print message

cin>>numInches; //input value by user

printFeetInchShort(numFeet,numInches); //calling method printFeetInchShort    

return 0;

}

Output:

Enter height feet: 5

Enter height inches: 9

height: 5'9"

Explanation:

In the above C++ language program, first, a header file is included, that uses the basic function, in the next step, the "printFeetInchShort()" method is defined, in the method two integer variables passed as a parameter, inside this method a print function "cout" is used, that print user input value with single and double quote.

Then the main method is declared, inside this method two integer variables "numFeet and numInches" are defined, which is used to take input value by user and pass the value in "printFeetInchShort()" function parameter and call the function.

4 0
3 years ago
Read 2 more answers
Choose all statements that identify the benefits of programming design.
Lubov Fominskaja [6]

Answer:

yes

Explanation:

it provides a design approach to a specific type of problem

4 0
3 years ago
Read 2 more answers
What coding language should i begin with if i'm looking to get into AI ?
loris [4]

Depends really. Have you got prior coding experience? The semantics of certain languages are much easier to pick up if you've had prior experience, but it might seem impossible to someone who has minimal experience.

Assuming that you're no older than 15 or 16, I'm going to suggest Python. It's a simple, high-level language that's easier to understand than most languages. If you think you've got enough experience to quickly understand and pick up things, then I'd probably say R is a good language to start with. It's very well-suited for AI and tends to be a favourite for AI researchers.

7 0
3 years ago
Write a program that asks the user for the number of males and the number of females registered in a class. The program should d
Bond [772]

Answer:

import java.util.Scanner;

public class PercentagePopulation {

public static void main(String[] args) {

 // 1. Create an object of the Scanner class

 // This will allow for user's inputs

 Scanner input = new Scanner(System.in);

 // 2. Create a prompt asking the user to enter the number of males

 System.out.println("Please enter the number of males");

 // 3. Receive the number entered by the user and store in an int

 // variable called  number_of_males.

 int number_of_males = input.nextInt();

 // 4. Create a prompt asking the user to enter the number of

               // females

 System.out.println("Please enter the number of females");

 // 5. Receive the number entered by the user and store in an int

 // variable  called, number_of_females

 int number_of_females = input.nextInt();

 // 6. Find the sum of the number of males and females

 // Store the result in an int variable called total.

 int total = number_of_males + number_of_females;

 // 7. Find the percentage of males by using the appropriate

 // formula.  Do a type-casting to allow for division in floating point

               // representation by prepending the number_of_males by (double)

 double percentagemales = (double) number_of_males / total * 100.0;

 // 8. Find the percentage of females by using the appropriate

 // formula.  Do a type casting to allow for division in floating point

               // representation by prepending the number_of_males by (double)

 double percentagefemales = (double) number_of_females / total * 100.0;

 // 9. Print out the results

 System.out.println("Percentage males : " + percentagemales + "%");

 System.out.println("Percentage females : " + percentagefemales + "%");

}

}

Explanation:

Please go through the comments in the code to give an explanation of the program. The source code file has also been added to this response. Please download it and go through it.

Download java
4 0
3 years ago
Other questions:
  • Anna wants to open the Run dialog box to run her program file. Which keys should she press to open the Run dialog box?
    14·1 answer
  • CHALLENGE ACTIVITY 4.2.2: Basic while loop with user input. Write an expression that executes the loop while the user enters a n
    14·1 answer
  • Which of the following would be the most appropriate way to address and greet your teacher, Mr. Joseph Herman, in an email? Hi J
    7·1 answer
  • What type of version of visual studio is the visual studio express
    8·1 answer
  • Convert 198 / 61 to ratio​
    9·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    11·1 answer
  • PLEASE HELP! WILL MARK AS BRAINLIEST!
    6·2 answers
  • You've just received an email message that indicates a new serious malicious code threat is spreading across the internet. The m
    10·1 answer
  • If your computer determines the destination address of a network packet is to a remote network.
    9·1 answer
  • Why should we apply print preview before printing the document.​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!