Study guides

☆☆

Q: Write c program to find sum of two numbers?

Write your answer...

Submit

Still have questions?

Related questions

write an assembly language program to find sum of N numbers

You add numbers as follows: sum = a + b;

double[] numsToSum; // the numbers you want to find the sum of double sum = 0.0; for(int i = 0; i < numsToSum.length; ++i) { sum += numsToSum[i]; }

Where are the numbers that you want to sum.

Algorithm and Flowcharts for a program to compute the sum of the squares of the numbers for a given range used for loop

Since there is an infinite set of prime numbers the answer would be infinity.

Write an. Algorthim. To. Find the. Sum. Of. First15 natural. Numbers

The following is for F95 and later (due to the use of intrinsic SUM ): My assumptions: -Your numbers are integers -Your numbers are stored in an array -The numbers you are describing are 0-100 program findSum !I assumed integer, replace this with your data type integer, dimension(100) :: numbers integer :: sumOfNumbers !We populate an array with our numbers !Replace this with your numbers do i=1,(size(numbers)+1) numbers = i end do !We find the sum of those numbers sumOfNumbers = sum(numbers) !We write out the sum to prompt write(*,*) 'Sum is: ', sumOfNumbers end program findSum

write a program to find the sum of squares up to 50

In Java:sum = 0;for (i = 2; i

Aim: - To write an assembly language program to find sum of cubes of given 'n' numbers.123456789MOV CL, NUMMOV SUM, 00L1: MOV AL, CLMUL ALMUL CLADD AL, SUMMOV SUM, ALLOOP L1ENDResult: Sum of cubes of first 'n' natural numbers is obtained.

In Java: // This program adds all numbers in the array int sum = 0; for (int i = 0; i < myArray.length(); i++) { sum += myArray[i]; }In Java: // This program adds all numbers in the array int sum = 0; for (int i = 0; i < myArray.length(); i++) { sum += myArray[i]; }In Java: // This program adds all numbers in the array int sum = 0; for (int i = 0; i < myArray.length(); i++) { sum += myArray[i]; }In Java: // This program adds all numbers in the array int sum = 0; for (int i = 0; i < myArray.length(); i++) { sum += myArray[i]; }

People also asked