(b+5)
Assuming that a and b are two non-negative numbers, then their sum is a + b and the difference is |a - b|.
3(a + b) + a = 3a + 3b + a = 4a + 3b
You remember that 'sum' means addition so that's b+11
it's: a + b
int mul (int a, int b) { int sum= 0; for (; b>0; --b) sum -= -a; for (; b<0; ++b) sum -= a; return sum; }
The sum of is the total of everything being summed; the sum total. Thus the sum of a, b and c is therefore a + b + c.
The sum of b and 8 would be written b+8 or 8+b(commutative property of addition)
/*use "c-free" compiler*/ #include <stdio.h> main() { int a,b,c; printf("enter the value of a & b"); scanf("%d%d",&a,&b); c=a+b; printf("sum of the two numbers is a+b- %d",c); getch(); }
b+11
(3+b)
(b+5)
Assuming that a and b are two non-negative numbers, then their sum is a + b and the difference is |a - b|.
#include<iostream> int main() { std::cout << "Enter value a: "; double a; std::cin >> a; std::cout << "Enter value b: "; double b; std::cin >> b; double sum {a+b}; std::cout << "a + b + (a + b) * (a + b) = " << sum + sum * sum << std::endl; }
3(a + b) + a = 3a + 3b + a = 4a + 3b
I suppose you wanted to ask: how to do multiplication with repeated addition. int mul (int a, int b) { int sum= 0; int sign= 1; if (b<0) { sign= -1; b= -b;} for (; b; --b) sum = sum + a; return sign*sum; }
You remember that 'sum' means addition so that's b+11