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
What type of device is characteristic of an enterprise environment?
Nitella [24]
A workstation used at an engineering firm.
8 0
3 years ago
Analyze a software application that enables people to purchase prescription drugs on the internet. briefly describe this applica
stiv31 [10]
This question makes no sense
8 0
3 years ago
Is windows 7 professional faster than home premium?
Olin [163]
Widows 7 is no longer supported for anti virus, I recommend a windows 10 license
8 0
2 years ago
Write a python program to calculate the sum of three numbers and as well require the user to input the numbers.​
beks73 [17]

Answer:

numbers = []

for i in range(3):

 numbers.append(eval(input("Enter number: ")))

print('Sum is:', sum(numbers))

Explanation:

You want to use a loop to prevent repeating your code.

8 0
2 years ago
What is an computer engineering?? ​
Nana76 [90]

Answer:

Computer engineering is a branch of engineering that integrates several fields of computer science and electronic engineering required to develop computer hardware and software.

Explanation:

5 0
2 years ago
Other questions:
  • What type of product does amd manufacture
    5·1 answer
  • 3-d metal printing, artificial intelligence, and self-driving cars are examples of ___________.
    10·2 answers
  • Vlad is the leader of a group; he receives most of the messages from the group members, and he provides most of the information
    6·1 answer
  • What video game has made the most money as of 2016?
    15·2 answers
  • Your employer is opening a new location, and the IT director has assigned you the task of calculating the subnet numbers for the
    14·1 answer
  • a machine needs a minimum of 100 sec to sort 1000 names by quicksort what is the approximate worst case time needed to sort 100
    13·1 answer
  • Why does the IPv6 format use letters and numbers?
    12·1 answer
  • Question Mode Matching Question Match the following description with the appropriate programming language generation. 1GL 1GL dr
    7·1 answer
  • How to make a harmonic mean algorithm in bash Linux?
    15·1 answer
  • What are the words that make up a high-level programming language called?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!