Study guides

☆☆

Q: The sum of integer for 0?

Write your answer...

Submit

Still have questions?

Continue Learning about Math & Arithmetic

sum of positive integers will be a positive integer

The 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.

3 is the smallest integer that cannot be written as the sum of two squares. This is easy to see, since the only squares less than or equal to 3 are 0 and 1.

The sum of a number and its inverse is 0, because that's what "its inverse" means. Inverse is whatever you need to use to "undo" the operation. For example, (2)+(-2)=0. If you go forward 2, then backward 2, you are where you started.

Not necessarily. That only applies if the positive integer is greater than the negative integer in absolute value.An integer.

Related questions

what is the sum of the first 10 positive integers? To me, if you include 0 as the first integer, then the tenth integer is 9 and the sum is 45. If you don't include 0, the tenth integer is 10, and the sum is 55.

String num = Integer.toString(12345); // Insert your Integer here. int sum = 0; for(int i = 0; i < num.length(); i++){ sum += Character.digit(num.charAt(i), 10); } System.out.println(sum); // Simply prints the sum of the digits to standard out. ///// ALTERNATE SOLUTION: int num = 12345; // Insert your Integer here. int sum = 0; while (num > 0){ sum += num % 10; num /= 10; } System.out.println(sum); // Simply prints the sum of the digits to standard out.

Sum the digits in the odd positions in the integer. Sum = XSum the digits in the even positions in the integer. Sum = YIf X - Y is a multiple (including negative or 0), then the given integer is divisible by 11.

int i, sum; /* example using while */ sum = 0; i = 1; while (i <= 100) { sum += i; ++i; } /* example using for */ sum = 0; for (i = 1; i <= 100; ++i) sum += i;

int main() { int num, sum; printf ("Enter a positive integer: "); scanf ("%d", num); sum = 0; while (num>0) { sum += num%10; num/=10; } printf ("The sum of the digits is: %d\n", sum); return 0; }

The below method is written in the assumption that, the n numbers are sent as an ArrayList of Integer values. public void computeSumAndAvg(ArrayList lst){ Iterator itr = lst.iterator(); int sum = 0; float average = 0; int count = 0; while(itr.hasNext(){ Integer val = (Integer) itr.next(); sum = sum + val.intValue(); count++; } average = sum/count; System.out.println("Sum is: " + sum) ; System.out.println("Average is: " + average) ; }

The below method is written in the assumption that, the n numbers are sent as an ArrayList of Integer values. public void computeSumAndAvg(ArrayList lst){ Iterator itr = lst.iterator(); int sum = 0; float average = 0; int count = 0; while(itr.hasNext(){ Integer val = (Integer) itr.next(); sum = sum + val.intValue(); count++; } average = sum/count; System.out.println("Sum is: " + sum) ; System.out.println("Average is: " + average) ; }

The smallest 5 digit integer is -99999. The largest 5 digit integer is 99999. The sum is therefore 0.

sum of positive integers will be a positive integer

No. The sum of a positive integer and a negative integer has the same sign as the larger integer.

Dim no As Integer, r As Integer, sum As Integer = 0, n As Integer = 0 Console.WriteLine("Enter number" & vbLf)no = Int32.Parse(Console.ReadLine())n = noWhile n > 0r = n Mod 10n = n \ 10sum += r * r * rEnd WhileIf sum = no ThenConsole.WriteLine("{0} is a Amstrong number", no)ElseConsole.WriteLine("{0} is not a Amstrong number", no)End IfConsole.ReadLine()

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.

People also asked