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
Georgia [21]
3 years ago
6

Please use C programming to write a code segment as an answer. Instead of using an while-loop like the following code, please im

plement a code segment by using a do-while loop. What is the output of the code?
#include
void main()
{
int i = 0;
while (i < 5);
{
printf("%d ", ++i);
}
}
Computers and Technology
2 answers:
krok68 [10]3 years ago
5 0

Answer:

#include <stdio.h>

void main()

{

int i = 0;

do{

printf("%d ", ++i);

}

while (i < 5);

i=i+1;

}

}

Explanation

The #include needs to include something and that's the standard input and output which is coded has stdio.h

In the do while loop what it does is print the value of I while I is less than 5 and you increment I value so as to prevent infinite looping

Anna71 [15]3 years ago
4 0

Answer:

The program using do-while loop defined as follows:

Program:

#include <stdio.h> //include header file

int main() //defining main method

{

int i = 0; //defining integer variable i and assign value.

//defining do-while loop

do  

{

printf("%d", ++i); //print value

}while (i<5); //check condition  

return 0;

}

Output:

12345  

Explanation:

Output of given program:

In the given program, it will not print any value because in while loop semi colon is used which is not valid.

Program Explanation:

In the above C language program header file is included, which provides features to use basic function then the main method is defined inside this method an integer variable "i" declare, that holds a value which is "0".  In this method, the do-while loop is defined. In the do section, we print value and in the while block checks the condition which is i is less than 5.

You might be interested in
____________________deals with syntax and semantics ofinformation exchange.
Goshia [24]

Answer:

The answer is (a).Presentation Layer

Explanation:

This layer is located at the 6th level of the OSI model, responsible for delivering and formatting the information to the upper layer for further processing. This service is needed because different types of computer uses different data representation. The presentation layer handles issues related to data presentation and transport, including encryption,translation and compression.

3 0
3 years ago
Your customer, Maggie, wants to buy a gaming PC, and she specifically mentions that she wants an Intel CPU and intends to overcl
Ksenya-84 [330]

Answer:

Intel produces a series of unlocked CPU's that can be overclocked. These CPUs are from the "K" or "X" series. Example: Intel Core i9-9900K, Intel Core i9-10940X.

These are the few things that are to be kept in mind while overclocking:

-Motherboard: Motherboard should support overclocking. Example: Intel Z series, most AMD motherboards.

-Cooler: Boosting the clock speed increases the temperature. The cooler has to be upgraded to keep the temperatures low. Example: Water-cooled. Also, the heat sink has to be checked if it's working properly.

-Be ready to test your system in BIOS. Make sure the temperature, voltage, memory speed is stable for the set clock speed.

Explanation:

8 0
3 years ago
How many acute angles are in a square​
babymother [125]
0, a square has 4 right angles
7 0
2 years ago
Read 2 more answers
To assign the contents of one array to another, you must use ________.
iren [92.7K]

Answer:

Option c is the correct answer for the above question.

Explanation:

  • The array is used to holds multiple variables and the assignment operator can assign only a single variable at a time. So if a user wants to assign the whole array value into other array value then he needs to follow the loop.
  • The loop iteration moves on equal to the size of the array. It is because the array value moves into another array in one by one. It means the single value can move in a single time. So the moving processor from one array to another array takes n times if the first array size is n.
  • The above question asked about the processor to move the element from one array to another and the processor is a loop because the loop can execute a single statement into n times. So the C option is correct while the other is not because--
  1. Option 'a' states about one assignment operator which is used for the one value only.
  2. Option b states about the equality operator which is used to compare two values at a time.
  3. Option d states any of these but only option c is the correct answer.
  4. Option 'e' states none of these but option c is the correct.
8 0
2 years ago
A contact list is a place where you can store a specific contact with other associated information such as a phone number, email
NikAS [45]

Answer:

C++.

Explanation:

<em>Code snippet.</em>

#include <map>

#include <iterator>

cin<<N;

cout<<endl;

/////////////////////////////////////////////////

map<string, string> contacts;

string name, number;

for (int i = 0; i < N; i++) {

   cin<<name;

   cin<<number;

   cout<<endl;

   contacts.insert(pair<string, string> (name, number));

}

/////////////////////////////////////////////////////////////////////

map<string, string>::iterator it = contacts.begin();

while (it != contacts.end())  {

   name= it->first;

   number = it->second;

   cout<<word<<" : "<< count<<endl;

   it++;

}

/////////////////////////////////////////////////////////////////////////////////////////////////////////

I have used a C++ data structure or collection called Maps for the solution to the question.

Maps is part of STL in C++. It stores key value pairs as an element. And is perfect for the task at hand.

8 0
3 years ago
Other questions:
  • At the dsl local carrier's office, the __________ demultiplexes the data streams and converts them into digital data.
    10·1 answer
  • If all of Earth's history were squeezed into one 12-hour period, how long ago did Precambrian time end? How long did the Cenozoi
    15·1 answer
  • Which of the following refers to a feature of wikis that allows the restoring of earlier work in the event of a posting error, i
    9·1 answer
  • One of the most common uses of spreadsheet programs are communicating with others. O editing images and photos. O tracking and m
    8·2 answers
  • A previously saved labels report can be accessed from the
    9·1 answer
  • bryce's computer is acting unusually sluggish today he calls you an it techniician to see if you can find out what is going on a
    14·1 answer
  • What is an example of a hard skill?
    12·2 answers
  • What are 3 software programs for mobile computing?
    10·1 answer
  • What is the<br>Way to<br>keep the tool<br>Screw​
    6·1 answer
  • MODS ONLY answer this, I have something for you. I'm reporting this to make it easier
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!