Calculate the sum of the first 5 positive odd integers: Let's do this in our head first, so we can check if our code is right or not!
The first positive 5 odd integers are: 1, 3, 5, 7, 9
Sum these to: 25
int sum = 0, k; <------These just declare our variables, telling the program 'Hey, I'm going to use 'sum' and 'k' to store data.
for (k = 1; <---We're going to repeat the following code, and we're starting at 1
k <= 10; <---- We're going to continue to repeat until we greater than 10.
k += 2) <------ Every time we do a loop, we're going to add 2.
{ sum += k; } <---- We're going to increase the number inside "sum" by the number inside "k"
Let's run this and see what happens. Remember, we keep going until we hit more than 10.
Round 0: k = nothing, sum = 0 (before we start the loop)
Round 1: k = 1, sum = 1
Round 2: k = 3, sum = 1+3 or 4
Round 3: k = 5, sum = 4 + 5 or 9
Round 4: k = 7, sum = 9 + 7 = 16
Round 5: k = 9, sum = 16 + 9 = 25
Round 6: k = 11, sum = 25 + 11 = 36
Well, we can tell here that round 5 was correct, but round 6 is not correct. And our loop condition says <=10, which means we have to do Round 6.
This means we did it one too many times. Our ending condition should be <10, instead of <=10.
Option B
Answer:
CUI will be classified at a “moderate” confidentiality level and follow DoDI 8500.01 and 8510.01 in all DOD systems. Non-DoD systems must provide adequate security with requirements incorporated into all legal documents with non-DoD entities following DoDI 8582.01 guideline
Explanation:
<span>Second generation of computer apparatus. Second Generation: Transistors
(1956-1963)</span>
The world
would see transistors substitute vacuum tubes in the second generation of
computers. The transistor was created at Bell Labs in 1947 but did not see omnipresent
use in computers until the late 1950s.
The
transistor enormously higher positioning to the vacuum tube, allowing PCs to
transform into littler, speedier, less expensive, more vitality effective and
more dependable than their first-generation predecessors. Though the transistor
still generated a great deal of heat that subjected the computer to destruction,
it was a vast development over the vacuum tube. Second-generation computers
still confidence on punched cards for input and printouts for production.
<span> </span>
Answer:
Sure!!! and thank you very much
In python:
total = 0
i = 0
while total <= 100:
number = int(input("Enter a number: "))
i += 1
total += number
print("Sum: {}".format(total))
print("Numbers Entered: {}".format(i))