15
Wiki User
∙ 12y agoThe sum of a positive integer and a negative integer is positive when the positive integer is greater. For example: 9 + (-5) = 4 In this case, the positive integer 9 is greater than the negative integer 5. Therefore, the sum is positive.
When the positive integer is farther from 0 than the negative integer, example -4+5=1 why? the -4 is 4 places to the left of the 0 and the 5 is 5 places to the right.
No, -3 + 8 = 5.
Let's denote the unknown integer as "x". So now we have two integers, "x" and "4x" because one integer is 4 times the other. So the sum of x+4x= 5x 5x = 5 So x=1
The sum of two positive numbers is positive. The sum of two negative numbers is negative. The sum of a positive and negative number will depend on which number has a greater absolute value. 5 + (-4) = 1 5 + (-9) = -4
200*201/2=20100
-18
When the positive integer is farther from 0 than the negative integer, example -4+5=1 why? the -4 is 4 places to the left of the 0 and the 5 is 5 places to the right.
The odd positive integer factors of 70 are: 1 5 7 35 The sum of these factors is 1 + 5 + 7 + 35 = 48
The smallest 5 digit integer is -99999. The largest 5 digit integer is 99999. The sum is therefore 0.
No, -3 + 8 = 5.
Let's denote the unknown integer as "x". So now we have two integers, "x" and "4x" because one integer is 4 times the other. So the sum of x+4x= 5x 5x = 5 So x=1
Not necessarily. It depends on which number has a greater absolute value. 5 + (-4) = 1 5 + (-9) = -4
The sum of two positive numbers is positive. The sum of two negative numbers is negative. The sum of a positive and negative number will depend on which number has a greater absolute value. 5 + (-4) = 1 5 + (-9) = -4
It is the negative of the sum of the two positive equivalents. For example, (-5) + (-8) = -[5 + 8] = -13
It is: 5*6*7 = 120 and 5+6+7 = 18
#include<iostream> #include<sstream> using namespace std; unsigned sum_of_squares (const unsigned max) { if (max==0) return 0; if (max==1) return 1; return sum_of_squares (max-1) + (max*max); } int main () { unsigned num = 0; while (1) { cout << "Enter a positive integer (0 to exit): "; string s; cin >> s; if (s[0]=='0') break; stringstream ss; ss << s; if (ss >> num) { cout << "The sum of all squares from 1 to " << num << " is: " << sum_of_squares (num) << endl; continue; } cerr << "Invalid input: " << s << endl; } cout << "Quitting..." << endl; } Example output: Enter a positive integer (0 to exit): 1 The sum of all squares from 1 to 1 is: 1 Enter a positive integer (0 to exit): 2 The sum of all squares from 1 to 2 is: 5 Enter a positive integer (0 to exit): 3 The sum of all squares from 1 to 3 is: 14 Enter a positive integer (0 to exit): 4 The sum of all squares from 1 to 4 is: 30 Enter a positive integer (0 to exit): 5 The sum of all squares from 1 to 5 is: 55 Enter a positive integer (0 to exit): 6 The sum of all squares from 1 to 6 is: 91 Enter a positive integer (0 to exit): 7 The sum of all squares from 1 to 7 is: 140 Enter a positive integer (0 to exit): 0 Quitting...