If both are unknown, you have to keep it as a+b. If they're known, just add them
To solve the sum and difference of two terms, you can use the identities for the sum and difference of squares. For two terms (a) and (b), the sum is expressed as (a + b) and the difference as (a - b). To find their product, you use the formula: ((a + b)(a - b) = a^2 - b^2). This allows you to calculate the difference of squares directly from the sum and difference of the terms.
(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
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)
b+11
(b+5)
(3+b)
/*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(); }
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