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
WHY DO YOU DElete EVERY QUESTIONS THAT IS ASKED! Im a freaking guy, yes and i wont followers for my channel so leave me alone!
skelet666 [1.2K]

Answer:

okie

Explanation:

8 0
2 years ago
Read 2 more answers
Sam wants to move across the text and his documents to add data at predefined stops. Which key will Hughes to navigate through t
Setler [38]

Answer:

The TAB key

Explanation:

Sam would use the TAB key, located on the left side of the keyboard, to move around his document to add stops and format its information properly.

Pressing the TAB key will introduce a tab code in his document, which is like moving ahead by a certain number of spaces (5,6, 10 spaces for example, depending on the configuration of the document), but without using spaces, using a tab which is a much better option to position, align things up.

5 0
3 years ago
Dam naj za pierwszej osobie która odpowie dobrze!
Rama09 [41]
I don’t understand that language
8 0
2 years ago
Write a program that calculates and displays the amount ofmoney available in a bank account that initially has $8000 deposited i
Leviafan [203]

Answer:

Written in Python

import math

principal = 8000

rate = 0.025

for i in range(1, 11):

    amount = principal + principal * rate

    principal = amount

    print("Year "+str(i)+": "+str(round(amount,2)))

Explanation:

This line imports math library

import math

This line initializes principal amount to 8000

principal = 8000

This line initializes rate to 0.025

rate = 0.025

The following is an iteration from year 1 to 10

for i in range(1, 11):

    This calculates the amount at the end of the year

    amount = principal + principal * rate

    This calculates the amount at the beginning of the next year

    principal = amount

    This prints the calculated amount

    print("Year "+str(i)+": "+str(round(amount,2)))

6 0
3 years ago
Can someone answer these 2 please
Leto [7]

Answer:

c for the first one and d for the secound one

Explanation:

5 0
2 years ago
Other questions:
  • Which of the following statements is false?
    10·1 answer
  • 8) Which of the following statements is FALSE?
    14·1 answer
  • Which of the following operations would best allow you to place 3D building models at their proper height on the terrain (e.g.,
    8·1 answer
  • Which character goes at the end of a line of code that starts with if?
    8·1 answer
  • Identify the following as True or False.
    14·1 answer
  • Hard and soft skills can both be transferable skills. *<br><br> True<br><br> False
    5·2 answers
  • What does Al stand for?
    10·1 answer
  • My friend has 200 subs and i have only 36 can you help me its ACYT ZR
    9·2 answers
  • What is gained by increasing the ritation speed of a disk or cd?​
    9·1 answer
  • Help
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!