Question

I'm stuck on this question and I have a hard time figuring this out, this used as C++

Question 26 10 pts (SHORT ANSWER) Use a loop to calculate and print the sum of numbers from 1 to 10 (both numbers inclusive).
0 0
Add a comment Improve this question Transcribed image text
Answer #1

// C++ Code:-

#include<iostream>
using namespace std;
int main()
{
// To store the sum of value from 1-10
int sum=0;
  
// Loop to calculate the sum
for(int i=1;i<=10;i++)
sum=sum+i;
  
//print the sum
cout<<"Sum of numbers 1-10 = "<<sum<<endl;
return 0;
}

main.cpp 1 #include<iostream> 2 using namespace std; 3 int main() 4-{ 5 // to store the sum of value from 1-10 6 int sum=0; 7

Add a comment
Know the answer?
Add Answer to:
I'm stuck on this question and I have a hard time figuring this out, this used...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Canvas А Question 7 Use the given information to answer the the following. z = 2(cos...

    Canvas А Question 7 Use the given information to answer the the following. z = 2(cos 115° + isin 115°)and w = 0.5(cos 305° + isin305) 5 points 2(zw) 5 points z divided by w 10 points The fifth root of z BIVA - A IX EE 1 . x' , EE 2 VX 11 12pt Paragraph I

  • This problem is considered from C++, I need to know the steps using the step-by-step function...

    This problem is considered from C++, I need to know the steps using the step-by-step function for me to fully understand on how to solve this tough problem. Question 30 10 pts (SHORT ANSWER) Write three separate if blocks to check the following THREE conditions (number your answers): 1. If the number variable testScore is outside the range of O through 100 (excluding both those scores), print the message: "INVALID: OUTSIDE RANGE 0-100" 2. If the number variable bonusPoints is...

  • I am having trouble figuring out what should go in the place of "number" to make...

    I am having trouble figuring out what should go in the place of "number" to make the loop stop as soon as they enter the value they put in for the "count" input. I am also having trouble nesting a do while loop into the original while loop (if that is even what I am supposed to do to get the program to keep going if the user wants to enter more numbers???) I have inserted the question below, as...

  • please answer both questions Question 10 Explain how a server using a single UDP socket can...

    please answer both questions Question 10 Explain how a server using a single UDP socket can differentiate between its clients? B IV AA- IEE..X XEE 2.2 VX - 1 12pt Paragraph O words Question 17 4 pts A socket on a host occupies how many IP addresses and port numbers? Β Ι Ο Α' A. IE3 3.x x, ! E - XT 12pt Paragraph

  • This is a C++ statement, how do I solve this problem using the void function? Question...

    This is a C++ statement, how do I solve this problem using the void function? Question 29 10 pts (SHORT ANSWER) Define a void function named swap2 Nums that accepts 2 integer reference parameters: num1 and num2. The function should then swap the two numbers. Use additional variable(s) as necessary. BIVA-AIK EE311xx, V TT 12pt Paragraph O words

  • I'm quite stuck with this C++ question, I would greatly appreciate the help! Many companies use...

    I'm quite stuck with this C++ question, I would greatly appreciate the help! Many companies use telephone number like 888- COM - CAST so the number is easier for their customer to remember. On a standard telephone, the alphabetic letters are mapped to numbers in the following fashion. A, B, and C = 2 D, E, and F = 3 G, H, and I = 4 J , K , and L = 5 M, N, and O = 6...

  • This exercise is also from C++ How do I even figure this out? please help me...

    This exercise is also from C++ How do I even figure this out? please help me solve so I can get the answer correctly! Question 28 10 pts (SHORT ANSWER) Define a function named findEvenOrOdd that has 1 int parameter: num. When the function is called, it should use an if/else statement -OR- conditional expression to determine whether the variable num is an even or odd number and display appropriate message as follows: • If the value in num is...

  • I need help and I'm stuck on this program. I have to do it in the...

    I need help and I'm stuck on this program. I have to do it in the C language on my Linux system. Can someone help me with this please? I have included my instructions and sample output. Thank you -Initialize 2 arrays within the main method, one with odd numbers and one with even numbers. -In the main method swap the arrays. -Print the arrays before and after the swap. //output should look like the following Before Swap firstArray[0] =...

  • I'm having a hard time answering and understanding this practice question I need help. solving and...

    I'm having a hard time answering and understanding this practice question I need help. solving and explaining it 4. (10 points) Determine which types of solution sets (inconsistent, unique solution, infinite) are possible for systems of linear equations with 7 equations and 10 variables,

  • python programming X Canvas 4 → XCO Question 26 10 pts (SHORT ANSWER) Define a function...

    python programming X Canvas 4 → XCO Question 26 10 pts (SHORT ANSWER) Define a function named find_even_odd that has 1 parameter: num. When the function is called, it should use an if/else statement to determine whether the variable num is an even or odd number and display appropriate message as follows: • If the value in num is an even number, the progr will output the message: "XX is an EVEN number", where XX is the value in the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT