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
What is a fruitful function? Explain with help of programming example?<br> plz
kupik [55]
These are the functions that return a value after their completion. A fruitful function must always return a value to where it is called from. A fruitful function can return any type of value may it be string, integer, boolean, etc. It is not necessary for a fruitful function to return the value of one variable, the value to be returned can be an array or a vector. A fruitful function can also return multiple values.
5 0
3 years ago
Which of the following correctly declares and initializes a Scanner object that will use input from the keyboard as its data sou
zepelin [54]
Option 4 is correct.........
5 0
3 years ago
Read 2 more answers
What are the atoms in grp one? periodic table. I am going to mark as brainliest ​
Maru [420]

Answer:

Atoms in group 1:

H

Li

Na

K

Rb

Cs

Fr

3 0
4 years ago
An op amp requires the design equation vout = 50vin 3vref agvg. what is the value of ag?
stich3 [128]
The possible solution for this kind of problem is to equate the said equation base on what is ask in the problem.  The design equation is use to get the Voltage out of a said circuit, thus, without any value of resistance, the left and side value of the equation should be the same, and the said problem is generally incomplete. With that, the possible answer would be -53.
4 0
4 years ago
A user is trying to log into windows on her notebook computer. she enters the correct password for her user account, but the sys
ASHA 777 [7]
Try restarting the PC. I have the same issue on Windows 10 sometimes generally its a network error because Windows 10 has a lot of internet required features... 
7 0
4 years ago
Other questions:
  • A(n) ______ database stores data in tables that consist of rows and columns.
    5·2 answers
  • You use this method to determine the number of items stored in an arraylist object.
    12·1 answer
  • You want to print only the fourth page of your research document. What would you do?
    9·2 answers
  • What is this effect in photoshop or photography?
    12·2 answers
  • Which type of memory helps in reading as well as writing data? With the help of , a computer can read as well as write or modify
    11·3 answers
  • A PC is not able to connect to a wired network. Pinging the loopback address is successful, but the gateway cannot be reached. O
    12·1 answer
  • URGENT: I need to add a while loop in this program but I don't know-how. I am also having trouble neatening some lines of code.
    15·1 answer
  • Think of a genre (science, music, math, sports, video games, etc.) and create at least 10 questions. You can decide whether you
    12·2 answers
  • Re:
    15·1 answer
  • Computer always produces wrong output true or false<br>​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!