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
Gekata [30.6K]
3 years ago
9

What are the three main components of a for loop?

Computers and Technology
1 answer:
insens350 [35]3 years ago
8 0

Answer:

Similar to a While loop, a For loop consists of three parts: the keyword For that starts the loop, the condition being tested, and the EndFor keyword that terminates the loop.

Explanation:

Loop statements usually have four components: initialization (usually of a loop control variable), continuation test on whether to do another iteration, an update step, and a loop body.

You might be interested in
What is the best data type for traveling day?
kykrilka [37]
Here if its wrong sorry

7 0
3 years ago
A circuit contains three resistors connected in parallel. The value of R1 is 2 K , the value or R2 is 6 K , and the value of R3
brilliants [131]
The value of total resistance of resistors connected in parallel is calculated through the equation,
      
                      R = 1 / (1/R1 + 1/R2 + 1/R3 + 1/Rn)

Substituting the known values,

                     R = 1 / (1/2 + 1/6 + 1/10)
                           R = 30/23 ohms

The formula for power with the use of resistance and voltage is,

                         P = V² / R

Substituting,
                         P = (100 V)² / (30/23 ohms)
                         P = 7.67 kW

Thus, the answer to this item is letter C.  
6 0
4 years ago
There are 12 inches in a foot and 3 feet in a yard. Create a class named InchConversion. Its main() method accepts a value in in
Dafna1 [17]

Answer:

import java.util.Scanner;

public class InchConversion

{

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

   

 System.out.print("Enter inches: ");

 double inches = input.nextDouble();

 

 inchesToFeet(inches);

 inchesToYards(inches);

}

public static void inchesToFeet(double inches){

    double feet = inches / 12;

    System.out.println(inches + " inches = " + feet + " feet");

}

public static void inchesToYards(double inches){

    double yards = inches / 36;

    System.out.println(inches + " inches = " + yards + " yards");

}

}

Explanation:

In the inchesToFeet() method that takes one parameter, inches:

Convert the inches to feet using the conversion rate, divide inches by 12

Print the feet

In the inchesToYards() method that takes one parameter, inches:

Convert the inches to yards using the conversion rate, divide inches by 36

Print the yards

In the main:

Ask the user to enter the inches

Call the inchesToFeet() and inchesToYards() methods passing the inches as parameter for each method

7 0
3 years ago
What are the benefits of writing functions that use parameters and return List 2 please and explain what is return
Ratling [72]

<u>Answer and explanation:</u>

There are many benefits of writing functions that use parameters and return. Some of them are:

1. Flexibility: With functions having parameters, several values of the parameters can be used at invocation time thereby making the application flexible. For example, given the following function in Java.

<em>public void showName(String name){</em>

<em>    System.out.println("Your name is " + name);</em>

<em>}</em>

To call this method (function), the programmer could use various values for the name parameter used in the function like so:

showName("John");

showName("Doe");

If the function didn't have a parameter, it is possible it will only print a hardcoded name every time the function is called.

2. Scope Control: When a function is allowed to return a value, it helps to work around scope issues since variables declared within a function are limited to that function and do not exist outside the function. This means that the values of these variables cannot be used anywhere else outside the function in which they are being declared. However, if the function returns a value, the value can be used anywhere else in the program.

For example:

<em>public String getDouble(int x){</em>

<em>    int y = x * 2</em>

<em>    return y;</em>

<em>}</em>

The function above returns twice the value of the argument supplied to it. Since the integer variable y is declared within the function, it's value cannot be used outside the function. However, since the value is being returned by the function, it could be used anywhere the function is being called. Thanks to the return keyword.

3 0
3 years ago
There are N rectangular buildings standing along the road next to each other. The K-th building is of size H[K] × 1.
Sphinxa [80]

Answer:

# you can write to stdout for debugging purposes, e.g.

# print("this is a debug message")

def solution(H):

   # write your code in Python 3.6

   

   # return area of atmost 2 banners

   # 1 banner

   # maximum height * number of buildings

   single_banner = max(H) * len(H)

   smallest_area = single_banner

   

   

   # 2 banner

   for i in range(1, len(H)):

       double_banner = (max(H[0:i]) * len(H[0:i])) + (max(H[i:]) * len(H[i:]))

       if  double_banner < smallest_area:

           smallest_area = double_banner

   

   return smallest_area

8 0
4 years ago
Other questions:
  • What type of code was Pinterest Pin button created in?
    10·1 answer
  • What is used to determine when the communications channels are clear and when a device is free to transmit data
    6·1 answer
  • Which of the following is NOT a unit used to measure temperature?
    13·1 answer
  • It is possible to force the Hardware Simulator to load a built-in version of chip Xxx. This can be done by: Select one: a. makin
    10·2 answers
  • There are some processes that need to be executed. Amount of a load that process causes on a server that runs it, is being repre
    7·1 answer
  • Choose the correct option that completes the sentence.
    13·1 answer
  • IN WHICH COUNTRY DO THEY LET YOU PLAY MINECRAFT IN SCHOOL?
    8·2 answers
  • Write a C program to find the sum of 10 non-negative numbers entered by user​
    14·1 answer
  • Which of the following screen elements is a horizontal bar that displays at the
    8·1 answer
  • HURRYY!!!<br> In the movie "Spare Parts" why can't Oscar enlist in the armed forces????
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!