Write a program to find the number and sum of all integers from 100 to 300 that are divisible by 11
public static final int getSum(final int n) { int sum = 0; for(int i = 1; i <= n; ++i) { sum += i; } return sum; }
1. Get any no. 2. Find it factors. 3. Add its factor. 4. If sum of its factors is equal to itself then it is a perfect no. otherwise not
This is a directive, not a question.
#include
The number is 6.
int sum = 0; int n = 0; while( sum <= 999 ) { sum += (++n); }
no thanks
Write a program to find the number and sum of all integers from 100 to 300 that are divisible by 11
write an assembly language program to find sum of N numbers
program SumAndDifference; var num1, num2, sum, difference: integer; begin write('Enter first number: '); read(num1); write('Enter second number: '); read(num2); sum := num1 + num2; difference := num1 - num2; if sum > difference then written('The sum is greater: ', sum) else written('The difference is greater: ', difference); end. This program will prompt the user to enter two numbers, calculate their sum and difference, and then compare the two values. If the sum is greater than the difference, it will display the sum; otherwise, it will display the difference.
The sum of the factors of any negative number is zero.
sum= answer of an addition question.. so the number of the sum is the answer.
public static final int getSum(final int n) { int sum = 0; for(int i = 1; i <= n; ++i) { sum += i; } return sum; }
sum=0 i=1 echo "Enter any number " read num while [ $i -le 10 ] do sum=`expr $num \* $i` i=`expr $i + 1` echo "Table of a number is " $sum done
The sum of the positive whole-number factors of 30 is 72.
You're referring to an Abundant Number(unlike a Perfect Number, which is equal to the sum of its factors).