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
Shalnov [3]
3 years ago
10

Write a loop to print 10 to 90 inclusive (this means it should include both the

Computers and Technology
1 answer:
Semmy [17]3 years ago
8 0

Answer:

The loop in cpp language is as follows.

for(int n=10; n<=90; n++)

{

cout<<n<<" ";

count = count+1;

if(count==10)

{

cout<<""<<endl;

count=0;

}

}

Explanation:

1. The expected output is obtained using for loop.

2. The loop variable, n is initialized to the starting value of 10.

3. The variable n is incremented by 1 at a time, until n reaches the final value of 90.

4. Every value of n beginning from 10 is displayed folllowed by a space.

5. When 10 numbers are printed, a new line is inserted so that every line shows only 10 numbers.

6. This is achieved by using an integer variable, count.

7. The variable count is initialized to 0.

8. After every number is displayed, count is incremented by 1.

9. When the value of count reaches 10, a new line is inserted and the variable count is initialized to 0 again. This is done inside if statement.

10. The program using the above loop is shown below along with the output.

PROGRAM

#include <stdio.h>

#include <iostream>

using namespace std;

int main()

{

   int count=0;

   for(int n=10; n<=90; n++)

   {

       cout<<n<<" ";

       count = count+1;

       if(count==10)

       {

           cout<<""<<endl;

           count=0;

       }

       

   }

   return 0;

}  

OUTPUT

10 11 12 13 14 15 16 17 18 19  

20 21 22 23 24 25 26 27 28 29  

30 31 32 33 34 35 36 37 38 39  

40 41 42 43 44 45 46 47 48 49  

50 51 52 53 54 55 56 57 58 59  

60 61 62 63 64 65 66 67 68 69  

70 71 72 73 74 75 76 77 78 79  

80 81 82 83 84 85 86 87 88 89  

90

1. In the above program, the variable count is initialized inside main() but outside for loop.

2. The program ends with a return statement since main() has return type of integer.

3. In cpp language, use of class is not mandatory.

You might be interested in
Add my epic games account "Lil Carr OXB" and if that not work, then "swish4444"
Andrew [12]

Answer:

-_________________________________-

Explanation:

-__________________________________________________________-

3 0
3 years ago
Read 2 more answers
Write a pseudo code to print sum of all even numbers from 1 to 100
Vinil7 [7]

(python) Answer:

sum = 0

for i in range 1 to 101:

 if i modulo 2 == 0:

   sum += i

print(sum)

Explanation:

first we declare the sum variable

then go through all numbers 1 through 100 (range 1 to 101 because python range does not include the last number - if we did 1 to 100 it would look at 1 to 99)

if the number is even (divide by 2, check if there's a remainder, if not it's even and we will add the number to the sum

finally print the sum

5 0
2 years ago
Sharon wants to import data from an old database into a new database. She notices some of the field names are different. Sharon
DerKrebs [107]

The answer to this question is Sharon will need to map.

4 0
3 years ago
Read 2 more answers
What is collaboration software?
LenKa [72]
<span>I'm not sure but I do know Collaboration means working together toward a mutual goal. so I hope that helps at least a little </span>
7 0
3 years ago
Read 2 more answers
Which clue can be used to identify a chemical reaction as a combustion reaction?
Alina [70]
A hydrocarbon reacts with oxygen
7 0
2 years ago
Other questions:
  • What are the basic computer components that must be purchased in order for the computer to function efficiently?
    11·1 answer
  • Which of the following software programs provides for e-mail communication?. A. Access. B. Word Perfect. C. Outlook. D. Excel
    15·2 answers
  • Which payment type is best if you are trying to stick to a budget?
    10·2 answers
  • .____________ is a way to identify and differentiate goods andservices through use of a name or distinctive design element.
    10·1 answer
  • Assuming that we only support BEQ and ADD instructions, discuss how changes in the given latency of this resource affect the cyc
    7·1 answer
  • How to select the entire worksheet?
    6·1 answer
  • For this exercise, we are going to take a look at an alternate Calculator class, but this one is broken. There are several scope
    15·1 answer
  • The program DebugTwo2.cs has syntax and/or logical errors. Determine the problem(s) and fix the program.// This program greets t
    5·1 answer
  • Manufacturing changes what materials into useful products
    6·1 answer
  • Diane, a developer, needs to program a logic component that will allow the user to enter a series of values
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!