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
MatroZZZ [7]
3 years ago
14

The difference between a for loop and a while loop is that a for loop is a loop that happens for a certain number of times. A wh

ile loop happens until a certain condition is met. How do you know when to use each one? Give specific examples in your answer.
Computers and Technology
1 answer:
Shalnov [3]3 years ago
4 0

For loop, if you have to fill water in a bucket three times, It will fill water in a bucket three times. While loop, If you have to take water from the well multiple times but stop when the water is empty in the well.

Explanation:

  • For loop is used mostly static way of programming.
  • While loop is used for dynamic approach of programming.
  • Static approach has fix number of times the task is done.
  • Dynamic approach is conditional attempt to complete the entire task.
  • For loop uses discrete which means it uses the count approach.
  • While loop is basis on characteristic, It works mostly with alphabet.
  • Functions play major role in while loop to take a dynamic approach.
You might be interested in
Fifty part-time students were asked how many courses they were taking this term. The (incomplete) results are shown below. Need
Ne4ueva [31]

Answer:

The answer for B is 10% and for C is 40%.

Explanation:

To get the percentage for B you take the the frequecy of students taking 2 courses (5) and multiply it by 100 then you divide it by whole number of students.

For C you do the after adding the number of students taking 1 or 2 courses (20).

5 0
3 years ago
Ultraportable computers will often use ___ technology exclusively, even though their storage capacity is lower than that of a tr
ki77a [65]

Answer:

SSD

Explanation:

8 0
2 years ago
When planning your website, what is one of the key things you should consider
Alex_Xolod [135]

You should definitely consider what kind of audience you are appealing to. For example, if you were running a business based on cosmetic products you may want to focus your website on self-care and makeup tips rather than something like cooking. By making your website direct about what you offer, the better the audience will understand. This will make your website succeed. Hope this helped :))

4 0
2 years ago
Read 2 more answers
Which C99 function can be used to convert a string to a double?
nordsb [41]

Answer:

atof

Explanation:

atof function is used to convert a string to a double.

It takes a single parameter of type const char * and returns a double value.

The function signature is: double atof (const char* str);

In order to use this function in the code, you need to include the header file <stdlib.h>

For example:

#include <stdio.h>

#include <stdlib.h>  

int main()

{

   char str[5] = "0.01";

   double d = atof(str);

   printf("Value = %f\n", d);

   return 0;

}

5 0
3 years ago
A proper divisor of a positive integer $n$ is a positive integer $d &lt; n$ such that $d$ divides $n$ evenly, or alternatively i
juin [17]

Answer:

The program written in Python is as follows:

<em>See Explanation section for line by line explanation</em>

for n in range(100,1000):

     isum = 0

     for d in range(1,n):

           if n%d == 0:

                 isum += d

     if isum == n * 2:

           print(n)

Explanation:

The program only considers 3 digit numbers. hence the range of n is from 100 to 999

for n in range(100,1000):

This line initializes sum to 0

     isum = 0

This line is an iteration that stands as the divisor

     for d in range(1,n):

This line checks if a number, d can evenly divide n

           if n%d == 0:

If yes, the sum is updated

                 isum += d

This line checks if the current number n is a double-perfect number

     if isum == n * 2:

If yes, n is printed

           print(n)

<em>When the program is run, the displayed output is 120 and 672</em>

4 0
3 years ago
Other questions:
  • When you are printing handouts, which of these can you do? A. Save paper by placing more than one slide per page. B. Check the f
    7·1 answer
  • Assume that the following variables have been defined in a program: int x = 10; int y = 20; int z = 30; Write a cout statement t
    11·1 answer
  • No matter what medium connects computers on network-copper wires, fiber-optic cables, or a wireless setup; the same protocol mus
    11·1 answer
  • _ models are non visual ways of communicating how someone thinks about something in the natural world
    12·1 answer
  • Write a program that first reads in the name of an input file, followed by two strings representing the lower and upper bounds o
    8·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    15·2 answers
  • It is usually simple to delete old posts and online conversations if they make you look bad.
    5·1 answer
  • A summer camp offers a morning session and an afternoon session. The list morningList contains the names of all children attendi
    6·1 answer
  • Why optical disk is slower than magnetic disk.?​
    9·2 answers
  • Why is a salt added to a password that is being stored in a database?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!