10,101,010 + 01,111 = 10,102,121Although you didn't say so, we suspect that you may have meantthe two numbers in the question to be binary (base-2) numbers.If so, then| 0 | 0 | 0 | 0= (170)100 | | | | = (15)10Their sum is (185)10
sum just means add and 100 and 100 when added together is 200.
The sum of the integers from 1 to 100 inclusive is 5,050.
library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity fabehv is Port ( ain : in STD_LOGIC; bin : in STD_LOGIC; cin : in STD_LOGIC; sum : out STD_LOGIC; cout : out STD_LOGIC); end fabehv; architecture Behavioral of fabehv is signal s:std_logic_vector(2 downto 0); begin process(ain,bin,cin,s) begin s(2)<= ain; s(1)<= bin; s(0)<= cin; case s is when "000" => sum<='0'; cout<='0'; when "001" => sum<='1'; cout<='0'; when "010" => sum<='1'; cout<='0'; when "011" => sum<='0'; cout<='1'; when "100" => sum<='1'; cout<='0'; when "101" => sum<='0'; cout<='1'; when "110" => sum<='0'; cout<='1'; when "111" => sum<='1'; cout<='1'; when others => null; end case; end process; end Behavioral;
n*(n+1)=sum 100*(100+1)=10100
0
The following will sum all integers from 1-100. Adjust according to your needs.int sum = 0;for (int i = 1; i
75 - 100 + 0 = -25
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;
You add the numbers in a loop. Here is an example in Java:int sum = 0;for (int i = 1; i
public class TestBB { /** * @param args */ public static void main(String[] args) { int sum = 0; int i = 0; do { sum = sum + i; i++; } while (i <= 100); System.out.println("Total of 100 numbers is: " + sum); } }
SUM = 0: FOR N = 1 to 100: SUM = SUM + N: Next N: PRINT CHR$(11); "Sum ="; SUM: END
100
its 5035the summarian notation tells you that(sum of all #from 0 to a number'N'(sum of all #from 0 to N) = (n)+(n-1)+(n-2)+(n-3)+...+(2) +(1) or(sum of all #from 0 to N) = (1)+ (2) + (3) + (4)+...+(n-1)+(n)the two different sums are aligned by columns. now add the two colunms accordingly and you'll get2x(sum of all #from 0 to N)=(n+1)+(n+1)+...+(n+1) (n+1)is added n timesso2x(sum of all #from 0 to N) =n(n+1)(sum of all #from 0 to N) =n(n+1)/2so (sum of 5 to 100) = (sum of 0 to 100)- (sum of 0 to 5)=100(101)/2 - 5(6)/2 = 5050 - 15 = 5035
#include using std::cout;using std::endl;int main(){int sum = 0;cout
#include using std::cout;using std::endl;int main(){const int numToAdd = 100;int sum = 0;for (int i = 1; i
main() { int i,sumo=0,sume=0,oddno,evenno; for(i=1,oddno=1,evenno=2;i<=100;++i,oddno=oddno+2,evenno=evenno+2) { sumo=sumo + oddno; sume=sume + evenno; } printf("Sum of odd nos = %d And Sum of even nos = %d,sumo,sume); }