// this v'll work to obtain sum of 1st and last number of any number
#include
int main()
{
int num,sum=0,i,fd,ld;
printf("enter the number);
scanf("%d",&num);
ld=n%10; //will get the last digit
while(num!=0)
{
fd=n;
n/10; //to get the 1st digit
}
sum=fd+ld; //add 1st n last digit
printf("\n sum of 1st n last digit is %d",sum)
}
write a program to find the sum of squares up to 50
5
ALGORITHM SAMPLE i = 0 REPEAT OUTPUT ("Enter a number: ") INPUT (number[i]) i ++ UNTIL (number[i] 0) THEN counter++ sum = sum + number[i] END IF END FOR DISPLAY (counter) DISPLAY (sum / counter) END SAMPLE
In Java, assuming you already created an array of int's, called myArray:int max = myArray[0];int sum = 0;for (int i = 0; i < myArray.length; i++){sum += myArray[i];if (myArray[i] > max)sum = myArray[i]}
10 for t = 1 to 50 20 input a 30 c = c + a 40 next t 50 print c
Well, it's very hard to write a flowchart in text, so I'll give you some pseudo code instead. int number = the given number int sum = 0 loop while number is not 0 sum = sum + (number mod 10) number = number / 10
5
sum= answer of an addition question.. so the number of the sum is the answer.
i dont now
ALGORITHM SAMPLE i = 0 REPEAT OUTPUT ("Enter a number: ") INPUT (number[i]) i ++ UNTIL (number[i] 0) THEN counter++ sum = sum + number[i] END IF END FOR DISPLAY (counter) DISPLAY (sum / counter) END SAMPLE
Assuming that you mean in a series of different integers variables. (java) public static void main(String[] args) { int count = (number of vaiables); int i=0; int sum = 0; while ( i<=count) { //this is hard to write without specific variables so treat it pusedo code sum = (sum + vari); System.out.println (sum); } }
a+21
Write the following as an algebraic expression using x as the variable: The sum of a number and -8
Quantifying the sum of two numbers is usually simple to do. You take the given sum of the two numbers and subtract it with one given unsummed number. This will give you the other number.
The number is 6.
n+3 the sum of a number and three means a number plus three.
n + 1
N + 15