Answer:
The solution code is written in C++.
- unsigned int SumOfDigits(int n){
- int sum = 0;
- sum += n % 10;
- n = n / 10;
-
- while(n != 0){
- sum += n % 10;
- n = n / 10;
- }
-
- return sum;
- }
Explanation:
Firstly, define a function with name <em>SumOfDigits()</em> that take one input integer, <em>n</em> and return an unsigned summation integer (Line 1). Next, we declare a variable sum to hold the value of summation of all the integer digits. Let's initialize it with zero (Line 2).
We can get the first digit from the integer by calculating the remainder of n after dividing it by 10 using modulus operator (%) and the remainder obtained is added to the sum variable (Line 3). Next, we divide the integer n by 10 (Line 4). This will discard the last digit of integer n (from the right).
We just need to repeat the process from Line 3-4 using a while loop so long as the current integer n is not zero (Line 6-8). We shall be able to take out the individual digit and add it to variable<em> sum</em>.
At the end, return the <em>sum</em> as output (Line 11).
Answer:
Figure 1 shows the neural network that computes the XOR of two inputs.
Two Input unit: X₁ and X₂
One hidden layer with two hidden units: h₁ and h₂
Two Weights for hidden unit 1 = 20, 20
Bias for hidden unit 1 = -10
Two Weights for hidden unit 2 = -20, -20
Bias for hidden unit 2 = 30
Weights for output layer = 20, 20
Bias for output layer = -30
Activation function = sigmoid (σ)
Output at hidden unit and at the output unit Y is shown in Table attached in Fig 2
Answer:
There is no "correct" name, but the scientific name could be meteorite.
Answer:
123.9 Btu
Explanation:
The energy balance on the air is:
∆E = E2 − E1 = ∆KE + ∆PE + ∆U = Q + W
ignore ∆KE and ∆PE,
W = ∆U − Q = m(u2 − u1) − Q; (u2 − u1 = 51.94 Btu/lb)
ideal gas properties is attached
W = (2 lb)(143.98 − 92.04) Btu/lb − (− 20 Btu) = 123.9 Btu
u2 − u1 ≈ cv(T2 − T1) = (0.173 Btu/lb°R)(840 − 540)
°R = 51.9 Btu/lb