Search snippets
Browse Code Answers
FAQ
Usage docs
Log In
Sign Up
Home
Whatever
Which block of code will sum the numbers from 1 to n (including n) and store it in the variable "sum"?
Evelyn1986
Programming language:
Whatever
2021-03-11 20:41:33
0
Q:
Which block of code will sum the numbers from 1 to n (including n) and store it in the variable "sum"?
dijter
Code:
Whatever
2021-07-16 16:06:46
int sum = 0; for (int count = 1; count <= n; count++) { sum = count; }
0
Tags
number
code
variable
sum
var
Related
Write a function that takes an array of number values and returns the sum.
swap 2 integers without using temporary variable
Read in three numbers, and calculate the sum. Output the sum as an integer. in c visual studio
Q5.WAP tofind out the sum of all prime numbers between 1 and n by using a user defined function (say isPRIME) to be used for prime number testing, where n is a value supplied by the user.
New to Communities?
Join the community