8096
sum = 0; for (int i = 12; i
A total is a variable that accumulates the sum of several numbers. Answer is based on C How to Program (6th Edition)
Cls input "enter two no.s ",a,b sum=a+b print "sum = ";sum end
int sum (int min, int max) {return (max-min+1)*(max+min)/2;}
Write an. Algorthim. To. Find the. Sum. Of. First15 natural. Numbers
To find the sum of two-digit numbers in an 8086 assembly program, you would typically load the two numbers into registers, add them using the ADD instruction, and store or display the result. Here's a simplified outline of the program: MOV AX, 12h ; Load first two-digit number (18 in decimal) MOV BX, 34h ; Load second two-digit number (52 in decimal) ADD AX, BX ; Add the two numbers ; AX now contains the sum (70 in decimal) This program assumes that the numbers are already defined and uses hexadecimal notation for clarity. The result can be further processed or displayed as needed.
write an assembly language program to find sum of N numbers
sum = 0; for (int i = 12; i
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
Since there is an infinite set of prime numbers the answer would be infinity.
To write an 8086 program for the addition of a series of 100 8-bit numbers, you can start by storing the numbers in an array in the data segment. Initialize a counter to track how many numbers have been added and a sum variable to hold the total. Use a loop to iterate through each number, adding it to the sum and incrementing the counter until all numbers are processed. Finally, store or display the result as needed. Here is a simple structure of the program: section .data numbers db 100 dup(0) ; Array of 100 8-bit numbers sum db 0 ; Variable to store sum section .text global _start _start: mov cx, 100 ; Set counter for 100 numbers lea si, [numbers] ; Load address of numbers array xor al, al ; Clear AL for sum initialization sum_loop: add al, [si] ; Add current number to AL inc si ; Move to next number loop sum_loop ; Repeat for all 100 numbers mov [sum], al ; Store the final sum ; Terminate the program (specific method depends on environment)
Shell problems are programs that can be run to find out information about numbers. The problem can help find an even or odd number, or what the sum of a cube is.
int sum(n) { if (n==0) return 0; else return n+sum(n-1); }
In Java:sum = 0;for (i = 2; i
#include<stdio.h> void main() { int num, sum=0, i; printf("Enter ten numbers: \n"); for(i=0;i<10;i++) { scanf("%d",&num); sum += num; } printf("\n The sum of the numbers is %d",sum); getchar(); }
The average of a group of numbers is equal to the sum of the numbers divided by the number of numbers. If you want to find the sum of the five numbers, just multiply 790.6 by 5 to get the sum, which is 3953
adding numbers together has the answer to the sum.