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

Write a program that computes the sum of the first tenpositive integers, 1 + 2 + ..+ 10.

Computers and Technology
1 answer:
Stella [2.4K]3 years ago
6 0

Answer:

#include <iostream>  

using namespace std;

int main()

{

  int sum=0;//taking an integer variable to store the sum with initial value 0..

  for(int i=1;i<=10;i++)//looping from 1 to 10..

  {

      sum+=i;//adding each i in the sum..

  }

  cout<<sum<<endl;//printing the sum..

   return 0;

}

Explanation:

output :- 55

1.I have taken an integer variable sum which is equal to 0.

2.Looping over first ten positive integers.

3.Adding every number to sum.

4.Printing the sum.

You might be interested in
Hello hello . please help me​
adelina 88 [10]

Answer:

#include <iostream>  

using namespace std;  

int main()  {  

 int num, check=0;  

 for(int num = 1; num<=100;num++){

for(int i = 2; i <= num/2; i++)  {

     if(num % i == 0)   {  

         check=1;  

         break;         }     }  

 if (check==0)  {       cout <<num<<" ";     }

 check = 0;

 }

 return 0;  

}

Explanation:

This line declares num as integer which represents digits 1 to 100.

A check variable is declared as integer and initialized to 0

<em>  int num, m=0, check=0;   </em>

This for loop iterates from 1 to 100

 for(int num = 1; num<=100;num++){

This iterates from 2 to half of current digit

for(int i = 2; i <= num/2; i++)  {

This checks for possible divisors

     if(num % i == 0)   {  

If found, the check variable is updated to 1

         check=1;  

And the loop is terminated

         break;         }     }  

The following if statement prints the prime numbers

 if (check==0)  {       cout <<num<<" ";     }

 check = 0;

 }

5 0
3 years ago
Read 2 more answers
Choose a different well-known company that you know of, and describe its direct and indirect competitors. Describe at least 2 di
geniusboy [140]
Nondirect competition is the variance between vendors whose products or services are not the same but that could gratify the consumer need
Lets take exampl of microsoft corporation
The indirect competitors are WHOLE FOODS and WAL-MART
Direct competitors sells the product or services that are same
the direct competitors are Apple, Google, HP, IBM
hope it helps
6 0
3 years ago
Read 2 more answers
What is the "thinking work" of the computer? How does it help the computer?
anyanavicka [17]

Answer:

El pensamiento computacional es una forma de pensar que utiliza habilidades propias de las ciencias de la computación, como la descomposición y resolución de problemas, lógica, el reconocimiento de patrones y la abstracción

Explanation:

Un computador sirve para guardar los teléfonos de tus amigos, las tareas del colegio, los trabajos de tu papá y mamá y hasta las cartas que le envías a tu novia.

4 0
3 years ago
Another word for asking a question of your data is to _____ it.
Temka [501]

Answer:

query

Explanation:

7 0
2 years ago
Abram needs to put multiple sets of data into the same type of calculations for different companies, so he will create a
Nesterboy [21]

Answer:

Themes, Cell Styles, Conditional Formatting, and Formulas

Explanation:

Got it right on Edg.

7 0
3 years ago
Other questions:
  • Which is the most likely problem with a static layout?
    5·2 answers
  • Why did the Wright brothers construct their own wind tunnel?
    11·1 answer
  • You are asked to add speech to a robotic receptionist that sits at the front desk of a large organization. The robot has an anim
    10·2 answers
  • Cheri's teacher told her to write a program that prompts the user for information. Which function should she use? input() int()
    14·1 answer
  • Explain the significance of the loss of direct, hands-on access to business data that end users experienced with the advent of c
    14·1 answer
  • When should you save your document?
    15·2 answers
  • Which statement is true?
    12·2 answers
  • Write the output of the following program:
    8·1 answer
  • Which of these is NOT an example of a GUI?
    7·1 answer
  • Is it possible to code your own game and if so then where should I go to learn and how to publish it?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!