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
andreyandreev [35.5K]
3 years ago
6

Explain how for loops can be used to work effectively with elements in an array?

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

Explanation:

There are three types of loops in programming languages which are as following:-

  1. for.
  2. while.
  3. do while.

The syntax for all the three loops is different.You will see mostly for loop used with the arrays because they are easy to implement.

the syntax of for loop is :-

for(int i=initial value;condition;i++)

{

body

}

In for loops you only have to write the conditions in only line else is the body of the loop.

for example:-

for array of size 50 printing the each element

for(int i=0;i<50;i++)

{

   cout<<arr[i]<<" ";

}

You have to initialize i with 0 and the condition should be i<size of the array and then increase the counter.

You might be interested in
Assume that x is a double variable that has been initialized. Write a statement that prints it out, guaranteed to have a decimal
Feliz [49]

Answer:

cout <<showpoint << x; is  the statement which  prints the decimal point,        but without forcing scientific.

Explanation:

The showpoint function in c++ print the decimal point number without forcing scientific.The showpoint function set  the showpoint format flag for the str stream in c++.

Following are the program in c++

#include<iostream> //header file

using namespace std; // namespace

int main() // main function

{

   double x=90.67; // double variable

   cout <<showpoint << x; // display x  without forcing scientific

  return 0;

}

Output

90.6700

6 0
3 years ago
The Olympic Games that people celebrate today are much different from the Olympics that began in ancient Greece. When the Olympi
kiruha [24]

Answer:

D

Explanation:

Option D explains the best about Olympic games. previously only few games were in Olympics but now thee are variety of games and some more games are trying to be a part of future Olympic games as well. There is no explanation about other options so we discarded those options, Which includes A) Greek mythology says that the Olympics were started by Heracles. B) Women were not allowed to watch the Olympic Games in ancient Greece. C) The ancient Olympics included sport such as running and chariot racing.

8 0
3 years ago
Read 2 more answers
How do i do this?
Ksivusya [100]

Answer: deezzz mf nuts

Explanation:

5 0
3 years ago
I need ideas for a scratch (imagine, share, and program) coding project. You can think of any project you'd like thanks! :)
alex41 [277]

You did not include enough information.

5 0
3 years ago
Read 2 more answers
Given three variables, a, b, c, of type double that have already been declared and initialized, write a statement that prints ea
mihalych1998 [28]

Answer:

The statement is written in Java.

  1. System.out.printf("%.5f %.5f %.5f",a,b,c);

Explanation:

Presume that there are three variable a, b and c which have already been declared and initialized with 4.014268319, 14309, 0.00937608 respectively.

To print each of the value with 5 digits to the right of the decimal point, we can use printf() method. We create a format specifier %.5f which is a placeholder of a floating point value. The .5 will specify five digits to the right of the decimal point.

We just create three similar format specifiers ( one for variable a, b, and c, respectively) and include them into printf() method. This will print the output as follows:

4.01427 14309.00000 0.00938  

6 0
3 years ago
Other questions:
  • What does media saturation mean?
    15·1 answer
  • Find some search engine as many that you can find
    9·1 answer
  • What is batch processing?
    12·1 answer
  • ____________ is a widely accepted international best practices framework for implementing information systems security.
    12·1 answer
  • The objective of ____ testing is to identify and eliminate execution errors that could cause a program to terminate abnormally,
    15·1 answer
  • A company that manufactures machine parts orders a new system that makes products at ten times the speed of the earlier machine.
    15·1 answer
  • Please explain what steps you will take to prevent hackers from getting access to your personal information.
    7·1 answer
  • The different languages that follow specific RULES. These languages use commands
    9·1 answer
  • eocs can be fixed locations, temporary facilities, or virtual structures with staff participating remotely.
    13·1 answer
  • Write a python program to check whether the number is divisible by 7. If its divisible, print its divisible otherwise find previ
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!