What is the function of for loop explain with example?

Answers

Answer 1

For loop is a type of looping structure that is used in programming to repeat a sequence of codes until a certain condition is met.

What is function?

In mathematics, a function is a relation between a set of inputs and a set of outputs, such that each input is related to exactly one output. Functions are often represented as mathematical expressions, or as a graph or table. The input to a function is known as the argument, while the output is known as the value. Functions are used to describe physical phenomena, and to model relationships between different variables.

It is commonly used to go through each element in an array or a list without having to write the same code multiple times. For example:

// Initialize array
int arr[] = {1, 2, 3, 4, 5};

// For loop to print out each element in the array
for (int i = 0; i < 5; i++) {
 System.out.println(arr[i]);
}
In this example, the for loop will print out each element of the array until it reaches the condition that i is less than 5, which is the length of the array.

To know more about function click-
https://brainly.com/question/2456547
#SPJ4


Related Questions

Grace bought 3 soccer balls for $14 each and 2 pairs of goalie gloves for $9 each. Write an expression for the total cost of the supplies. Then find the total cost. (LABEL)

Answers

Answer:

3(14)+2(9) is the equation

$60 is the total cost

Tell me if im right :)

Answer:

T=60

Step-by-step explanation:

=. Diego and Priya are each saving money. Diego starts with $80 in his savings account and adds $5
per week. Priya starts with $30 in her savings account and adds $15 each week.
After three weeks, who has more money in their savings account? Explain how you know.
a.

Answers

Answer:

diego. 80+(5x3)= 95

it isn't priya because 30+(5x3)=45

In Geometry, which kind of reasoning is used in proving theorems? Inductive or Deductive Reasoning? Why?

Answers

Answer:  

Inductive

Step-by-step explanation:

Because our conclusion is based on facts, the conclusions reached by deductive reasoning are correct and valid.

The Smith Family and the Jones family went to a buffet dinner at a restaurant. The restaurant charges one price for adults and another price for children. The Smith family has two adults and three children, their bill was $40.50. The Jones family has three adults and one child, and their bill was $38.00. Determine the price of one adult and one child ticket.

Answers

8Answer:

5

Step-by-step explanation:

evaluate the following expression 10x(-9+(-6))

Answers

Answer:

-150x

Step-by-step explanation:

Other option
B: 74.9
C: 15.1
D: 15.7

Answers

Step-by-step explanation:

cosine of B = adjacent/hypot

to find hypotenuse use a^2+b^2 = c^2

which is 5 (it's a 3,4,5 triangle so it's easy)

Cosine B= 4/5

which of the following equations uses the commutative property of addition to rewrite 1/4 + 2/5?

a) 1/4 + 2/5= 5/20 + 8/20
b) 2/5 + 1/4= 13/20
c) 13/20 - 2/5= 1/4
d) 2/4 + 1/5= 14/20​

Answers

Answer:

B)

Step-by-step explanation:

Hope that helps!

The equation in option (b), 2/5 + 1/4 = 13/20, uses the commutative property of addition to rewriting 1/4 +2/5.

What is the commutative property of addition?

The sum of two or more integers remains the same regardless of how they are grouped, according to the commutative property of addition.

The given expression is 1/4 + 2/5.

Simplify the expression as follows:
1/4 + 2/5

= (5 + 8)/20

= 13/20

Hence, it follows 1/4 + 2/5 = 13/20.

Now, using the commutative property of addition, the equation can be written as:

2/5 + 1/4 = 13/20

Hence, the equation in option (b), 2/5 + 1/4 = 13/20, uses the commutative property of addition to rewriting 1/4 +2/5.

Learn more about the commutative property of addition:

https://brainly.com/question/778086

#SPJ5

The length of a rectangle exceeds the breadth by 8 cm. Find the area of the rectangle, if its perimeter is 180 cm

Answers

Answer:

2009cm^2

Step-by-step explanation:

Given data

let the length be L

and the width be w

so

w= x

L=x+8

P= 180cm

P= 2L+2W

180= 2(x+8)+2(x)

180= 2x+16+2x

collect like terms

180= 4x+16

180-16= 4x

164= 4x

x= 164/4

x=41

W= 41cm

L= 41+8

L= 49cm

A= L*W

A=49*41

A=2009cm^2

Hence the area is 2009cm^2

150 grams decreased by 74% ?

Answers

Answer:

39

Step-by-step explanation:

multiple 159 by 74% them subtract

39
150 x .74= 111
150-111= 39

Two parallel lines are cut by a transversa

Answers

What is the question?

On a map the distance between Juneau and Fairbanks is 5 inches. The approximate distance is 625 miles. The distance between Denver and Fairbanks is 19.5 inches on the same map. What is the approximate distance from Denver to Fairbanks to the nearest mile?

Answers

Answer:

The answer for this question is 2,437.5 or rounded 2,438.

Step-by-step explanation:

5 goes into 19.5, 3.9 times to get that take 19.5÷5 to get 3.9. Then take 625×3.9 to get the total of 2,437.5 miles for your answer.

Answer:

Step-by-step explanation:

jhghgjhjgjjhgghghghgbhbjhbhvgjhgygyguygygyugglygygluyglygyggylgyugyygygygygygugyggyghjghgkygkhghgjkghhgghgghgggghghhghghghghghhgghghghghghghghgghghghghjhgjggjghghjgggghhhghggjkgkjghjjghkghjkggkghjggkhghgkhghkjghjghghjkgjhkgjhhjghgkhghgkjghjgjkhhjhhghgkjgghjj.

What is 36 divided by 1.5 in long division

Answers

Answer: 24

To calculate with long division when the divisor is a decimal, add zeroes in both the dividend and divisor. This means you get 360 ÷ 15.

From here, just do normal calculation and you get 24 as your answer.

I need help please):

Answers

Answer:

7) x = 5

8) x = 10

Step-by-step explanation:

7) 2x-3=x+2

x=5

8) 4x=2x+20

2x=20

x=10

Tom is playing at the opposite corner of the playing field to his friend . If the playing field is 180m wide and Tom is 300m away from his friend, how long is the playing field

Answers

Answer:

240 m

Step-by-step explanation:

we can picture this as a right triangle

(180)^2 + (l)^2 = (300)^2

300 would be the diagonal of the triangle since it is at the opposite corner

180 would be the height/leg of the triangle

Help! I’ll mark brainly! I really need help don’t have much time ! Please help<3

Answers

Here, hope this helps, if you have any questions about how I did anything feel free to comment

can anyone help with this???

Answers

Answer:

X= 13

A=104

C=26

Step-by-step explanation:

the equation is 8x+2x+50=180

10x=130

x=13

Find the area of the triangle... HURRRY PLZ HELP HELP HELP. ILL MARK BRAINLYIST THINGY

Answers

Answer:

38.25

Step-by-step explanation:

A = 1/2(8.5)(9)

Answer:

[tex]38.25 mm^{2}[/tex]

Step-by-step explanation:

Area of a triangle = 1/2bh

b = 8.5

h = 9

1/2(8.5)(9) = 38.25

Do the ratios 20/10 and 4/2 form a proportion? Yes or no

Answers

Answer:yes

Step-by-step explanation:they are equal

The area of a triangle A is given as A =1/2 bh, where b is the base an h = height. (a) find h if A =30 and b=10

Answers

Answer:

h = 6

Step-by-step explanation:

Substitute the given to its corresponding places.

30 = [tex]\frac{1(10)h}{2}[/tex]

30 = 10h/2

Multiply both sides by two to remove the denominator.

2 [30 = 10h/2] 2

60 = 10h

Divide both sides by 10 to isolate h.

h = 6

To check, substitute everything to the original equation:

A = [tex]\frac{1(10)(6)}{2}[/tex]

A = 30 !

PLEASE HELP I WILL GIVE BRAINALIST!!!!

AB contains points (4, 2) and (−1, −8). What is the equation of the line parallel to AB that contains point (0, 5)?

Answers

9514 1404 393

Answer:

  y = 2x +5

Step-by-step explanation:

We can use the slope formula to find the slope of AB, which is the same as the slope of the parallel line. Then, we can use the point-slope equation for a line to find the desired equation.

  m = (y2 -y1)/(x2 -x1)

  m = (-8 -2)/(-1 -4) = -10/-5 = 2

__

  y -y1 = m(x -x1) . .  point-slope form of equation for a line

  y -5 = 2(x -0) . . . . fill in m=2, (x1, y1) = (0, 5)

  y = 2x +5 . . . . . . . rearrange to slope-intercept form

PLEASE ITS DUE IN 5 MINUTES I WILL MARK BRAINLIEST!

Answers

Answer: A. the first one wouldn't graph with the x^2 but with it I would say A. Hope this helps

Simplify: 5 + p > 3
GIVING BRAINLIST!!! PLEASE HELP!

Answers

Answer:

p>3-5

p>-2

Step-by-step explanation:

step 1= 5 will pass the greaterthan sign and it will be -ve

step 2= it will be (p>3-5) 3-5= -2

answer = p> -2

Answer:

The answer is p > -2

Step-by-step explanation:

Move all terms not containing  p  to the right side of the inequality.

~Hoped this helped~

Determine the y-intercept of the line from the graph 3 2 1 -3 -2 -1 1 2 3 4 -2 <<​

Answers

Answer:

Y-intercept is 0

Step-by-step explanation:

The line crosses at 0,0

x intercept is 0

Y intercept is 0

The y-intercept is 0 as that is where the line passes through on the y-axis.

How many points does a student need to score 70% on a 80 point test?

Answers

Answer: 56

Step-by-step explanation:

70÷100×80=56

Answer:

56

Step-by-step explanation:

Another way to write this question is "What percent of 80 is 70%."

So we would write a percent proportion:

x/80=70/100

To find x, we will do (80*70)/100 which is 5600/100 which is 56.

You could also use benchmark fractions:

10% of 80 is 8

10% * 7 = 70% so 8 * 7 also equals 70%

8 * 7 = 56

Hope this helped, let me know if you have any questions.

True or False? If one of the angles of a triangle is obtuse, then the triangle is obtuse.

Answers

Answer:

True

Step-by-step explanation:

Image result for True or False? If one of the angles of a triangle is obtuse, then the triangle is obtuse.

In an obtuse triangle, if one angle measures more than 90°, then the sum of the remaining two angles is less than 90°. Here, the triangle ABC is an obtuse triangle, as ∠A measures more than 90 degrees. ... Hence, if one angle of the triangle is obtuse, then the other two angles with always be acute.

Answer:

True, as long as the other angles are acute !!

Step-by-step explanation:

I hope this helps !! :D

2x2– 21x = 11 what would the x be

Answers

Answer:

x = -1/3

Step-by-step explanation:

The X would be -1.7

2(1/2z+ 4)- 0.5

what could this be re written as?

a. z-3.5
b. z+7.5
c. z+8.5
d. 2z+3.5

Answers

B
First simplify whatever is in the parenthesis, do 2 times 1/2 and 2*8, which equates to z+8-0.5. Simplify further by subtracting 0.5 from 8 and you get z+7.5

Answer:

B. z+7.5 is the answer I chose

solve this linear equation with HOW you did it please.
9k-5k=-32

Answers

Answer:

k = -8

Explanation:

9k - 5k = -32

4k = -32

k = -8

PLS HELP WILL MARK BRAINLIEST !!!!!!

Which of the following variables is most commonly graphed on a line graph?
distance
time
speed
size

Answers

Answer:

If these are answer choices, i believe the correct answer is B, time.

Step-by-step explanation:

Answer:

It's Time

Step-by-step explanation:

math help please (question 2)

Answers

x>_0 y>_-4 your domain is the opposite of whats inside of the radical, in this case it’s zero but if the number was -5 you would say x>_ 5. Your range is whatever number is in the back, which is negative 4. But you have to pay attention, if there is a negative before the radical your range will be y<_ the number. But here, there isn’t a negative sign in the front of the radical so it’s just y>_ -4.
Other Questions
true/false. the level of corruption in a country is usually a good indicator of the degree of good or poor governance in that country. The peak overpressure expected as a result of the explosion of a tank in a plant facility is approximated by the equation:log P=7.1094 1.8 log rwhere P is the overpressure in N/m^2 and r is the distance from the blast in meters. The plant employs 500 people who work in an area from 3 to 150 m from the potential blast site. Estimate the number of fatalities due to lung hemorrhage as a result of this blast. Assume there are 5 shells around the center and the people are evenly distributed through the area. for a particular reaction at 164.4 c, =833.32 kj , and =866.05 j/k . calculate for this reaction at 79.0 c. An electromagnetic wave is traveling through vacuum in the positive x direction. Its electric field vector is given by = Esin(kx - wt); where is the unit vector in the y direction If B is the amplitude of the magnetic field vector, find the complete expression for the magnetic field vector B of the wave. ViewAvailable Hint(s) O Bo sin(kx wt) O Bo sin(kx wt) O Bo sin(kr -wt)k O Bo cos(kx - wt) i O Bo cos(kx wt) O Bo cos(kx -wt) rheas voluntary petition for bankruptcy is found to be proper. the order for relief is effective as soon as which of the following represents the correct sequence of events occurring upon glucagon binding to receptors on hepatocytes? according to your book, the following statement is an example of what type of fallacy? there can't be anything wrong with cheating on exams if 75 percent of college students do it. what are the similarities between the fall of the house of usher and where is here The First Continental Congress met in 1774 and proposed a plan to Great Britain that required Plaiment and a new American legislature to jointly consent to laws pertaining to the colonies. a. True b. False from a communication standpoint, what is the best place to conduct an interview? Which one of the following global climate changes is most associated with increased hurricane activity?warmer oceans in cycling of matter in ecoystems, you learned that all body matter is eventually replaced. how does this influence your understanding of how your own body is involved in biogeochemical cycles? The height of a right rectangular pyramid is equal to x units. The length and width of the base are units and units. What is an algebraic expression for the volume of the pyramid? Cross-section of rectangular pyramids having a height of x from the center at a right angle with a length of x plus 5 and width of x minus 1 by 2 All of the following were credited to Carnegie's success in the steel business EXCEPT ______. a patient has been taking fluoxetine for 2 years and reports feeling cured of depression. the nurse learns that the patient is sleeping well, participates in usual activities, and feels upbeat and energetic most of the time. the patient's weight has returned to norma. the ppatient reports last having symptoms of depression at least 9 months ago. what will the nurse tell this patient? Suppose that result is declared as DWORD, and the following MASM code is executed:mov eax,7mov ebx,5mov ecx,6label5:add eax,ebxadd ebx,2loop label5mov result,eaxWhat is the value stored in the memory location named result? in deciding whether an ad is deceptive, today the ftc basically follows the "modified" gullible-consumer standard. true or false ? 7. Estimate the gravitational force between two sumo wrestlers, with masses 220 kg and 240 kg, when they are embraced and their centers are 1.2 m apart. 8. On a planet whose radius is 1.2 * 107 m, the acceleration due to gravity is 18 m/s2 What is the mass of the planet? 9. Two planets in circular orbits around a star have speeds of vand 2v. (a) What is the ratio of the orbital radii of the planets? (b) What is the ratio of their periods? an experimental psychologist predicted students will learn reading faster using the new reading technique compared to the traiditional techniquea. one-tailedb. two-tailed EXERCISE 3 THE FOUNDER EFFECT Work in a small group to complete this exercise. In this exercise, you will simulate a case of the founder effect. STEP 1 Gather your lab materials. You should have: - 1 cup (which will hold the alleles for an entire population-the gene pool) - 20 red beans (representing the dominant allele (R) for a simple Mendelian trait) - 20 white beans (representing the recessive allele ( r ) for the same trait) Note: You may substitute other everyday objects (such as candies, coins, or paper clips) for the beans, but be sure to designate which objects represent the dominant versus recessive alleles.