1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
algol [13]
3 years ago
12

Write a while loop that adds the first 100 numbers (from 1 to 100) together. To do so, use a while loop that continues while the

condition of cur_num being less than or equal to stop_num is True. Inside the loop, it should add cur_num to the running total variable, and also add 1 to cur_num. Make sure to check at the end that the value of total reflects the total summation.

Computers and Technology
2 answers:
Anettt [7]3 years ago
6 0

Answer:

cur_num = 0

stop_num = 100

total = 0

while cur_num <= stop_num:

   total += cur_num

   cur_num += 1

print(total)

Explanation:

Initialize the variables

Initialize a while loop that iterates while cur_num is smaller than or equal to stop_num

Add the cur_num to total in each iteration to calculate the total

Increase the cur_num at then end of each iteration to control the loop

When the loop is done, print the total

Andreas93 [3]3 years ago
6 0

Answer:

I am writing JAVA and C++ program. Let me know if you want the program in some other programming language.  

Explanation:

JAVA program:

public class SumOfNums{

public static void main(String[] args) { //start of main function

int cur_num   = 1; // stores numbers

int stop_num= 100; // stops at this number which is 100

int total = 0; //stores the sum of 100 numbers

/* loop takes numbers one by one from cur_num variable and continues to add them until the stop_num that is 100 is reached*/

while (cur_num <= stop_num) {

 total += cur_num; //keeps adding the numbers from 1 to 100

//increments value of cur_num by 1 at each iteration

 cur_num = cur_num + 1;}

//displays the sum of first 100 numbers

System.out.println("The sum of first 100 numbers is: " + total); }}  

Output:

The sum of first 100 numbers is: 5050

C++ program

#include <iostream> //for input output functions

using namespace std; //to identify objects like cin cout

int main(){     //start of main() function body

int cur_num   = 1; // stores numbers

int stop_num= 100; // stops at this number which is 100

int total = 0;//stores the sum of 100 numbers

/* loop takes numbers one by one from cur_num variable and continues to add them until the stop_num that is 100 is reached*/

while (cur_num <= stop_num) {  

//keeps adding the numbers from 1 to 100

//increments value of cur_num by 1 at each iteration

 total += cur_num;

 cur_num = cur_num + 1; }  

//displays the sum of first 100 numbers

cout<<"The sum of first 100 numbers is: "<<total; }

The output is given in the attached screen shot.

You might be interested in
What is the destination ip address when an ipv4 host sends a dhcpdiscover message?
hjlf

The destination ip address when an ipv4 host sends a DHCPDISCOVER message Because a DHCP client does not have a valid IPv4 address, it must use a broadcast IP address of 255.255. 255.255 as the destination address to communicate with the DHCP server.

<h3>What does the DHCP server do when it receives the Dhcpdiscover message?</h3>

When the lease has expired, the client must start over with the DHCPDISCOVER process. The client ends the lease by sending a DHCPRELEASE message to the DHCP server. The server will then return the client's IP address to the available address pool.

<h3>What is a Dhcpdiscover message?</h3>

The DHCPDISCOVER message contains an identifier unique to the client (typically the MAC address). The message might also contain other requests, such as requested options (for example, subnet mask, domain name server, domain name, or static route). The message is sent out as a broadcast.

To learn more about DHCPDISCOVER, refer

brainly.com/question/14407739

#SPJ4

8 0
1 year ago
3. Describe what a pre-processor does in a network-based IDS tool such as Snort. Demonstrate your understanding of this function
MrRissso [65]

Answer:

Pre-processors look at organize traffic and screens parcel transmissions by examining andreassembling divided data.Frag2:preprocessor that battles against IP fracture attacks.Attackers sends a fragmentedTCP bundle with header data that gets entrance through a firewall.At the equivalent time,other parcels with vindictive information "slip" by the firewall undetected because of the fragmentationbeing so little by overwriting the header information.The frag2 pre-processor is specificallydesigned to break down bundle discontinuity to search out noxious information in the sections, which iswhy this pre-processor ought to never be turned off.Stream4:preprocessor Snort uses to coordinate assault marks over numerous packets.Anattacker endeavors to send different parcels into the system conveying parts of the attackpayload which are required to be reassembled by the host so as to start an attack.Stream4 stores the bits of the mark until all bundles are transmitted.Once they are alltransmitted, Stream4 finishes the signature and an alarm is created.

Explanation:

8 0
3 years ago
Need help with these
kolbaska11 [484]
The first one is d the second one is true the third one is false
3 0
3 years ago
What is the system that consists of nonproprietary hardware and software based on publicly known standards that allow third part
il63 [147K]

Answer:

Open systems

Explanation:

Open systems are very different from Open Source applications or software, it should not be confused.

Open systems work with the blend of open software standards, portability, and interoperability. Computer systems that interoperate among multiple standards and vendors to ensure that computer resources (hardware and software) are not allotted to a particular vendor. Such computer systems are considered as open systems.

For instance, computer systems that run a Microsoft Windows OS can be considered as an Open system. This is because of their capability to run different versions of the Microsoft Windows OS on that particular computer system. More clearly, A computer with Windows 10 OS, can be used to install Windows 8 OS without any issue. That same computer system can run the Windows 7 OS. This makes the computer system and open system.

5 0
3 years ago
Sharing a workbook enables multiple users to access the workbook. What are the benefits of using a shared workbook?
damaskus [11]

Answer:

Some of the benefits of sharing a workbook include:

A. Shared information between students (ie: Mary writes a note about (blank) in the workbook and John reads said note and receives addition information about (blank)).

B. ^adding onto this, discussion on interpretations of a passage (ie: John thinks (blank) means this and Mary thinks (blank) means other thing, through notes they can discuss the meaning of the text.

Hope this helps. =)

8 0
3 years ago
Other questions:
  • What will be a fundamental aspect of future games??
    12·2 answers
  • 4. An outline is most like which of the following? (1 point)
    14·1 answer
  • Write a class named RetailItem that holds data about an item in a retail store. The class should store the following data in att
    15·1 answer
  • A thin red border indicates the active cell. (True or False)
    12·1 answer
  • When an interrogator speaks highly about how a crime was committed, hoping to get the suspect to brag about his or her involveme
    7·2 answers
  • Hey how are yall today?
    12·2 answers
  • Write a qbasic program to display integer numbers 1 to 100 using the for next loop<br>​
    9·1 answer
  • Which componet is the smallest unit in a spreadsheet
    15·1 answer
  • How many of these imformation have you shared​
    14·1 answer
  • Write l for law of enrtia,ll for law of Acceleration and lll for law of enteraction.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!