Discuss about the dangling else problem

Assignment Help Basic Computer Science
Reference no: EM131608130

Question: (Dangling Else Problem) Determine the output for each of the following when x is 9 and y is 11, and when x is 11 and y is 9. The compiler ignores the indentation in a C program. Also, the compiler always associates an else with the previous if unless told to do otherwise by the placement of braces {}. Because, on first glance, you may not be sure which if an else matches, this is referred to as the "dangling else" problem. We eliminated the indentation from the following code to make the problem more challenging. [Hint: Apply indentation conventions you have learned.]

a) if (x < 10)

if (y > 10)

puts ("*****");

else

puts("#####");

puts("$$$$$");

b) if (x < 10) {

if (y > 10)

puts ("*****");

}

else {

puts("#####");

puts("$$$$$");

}

Reference no: EM131608130

Questions Cloud

Printing numbers from a loop : Write a program that utilizes looping to print the numbers from 1 to 10 side by side on the same line with three spaces between numbers.
Marginal physical product : Nick has figured out that the marginal physical product (MPP) of the last instructor hired is 5 lessons, and the MPP of the last board used is 3 lessons.
Write report on Comparison of the use of RFID and QR code : ISIT 410 / ISIT 910 Supply Chain Management Assignment. Write report on Comparison of the use of RFID and QR code in supply chain management
Describe a time when a lie had major consequences for you : All the contents of the first paragraph need to be citation, and the last thesis statement sentence is not in the parallel form so it is deducted directly
Discuss about the dangling else problem : Determine the output for each of the following when x is 9 and y is 11, and when x is 11 and y is 9. The compiler ignores the indentation in a C program.
The american health information management association : Based on your own personal views, which specific law or act had the most significant advances for health information systems. Please discuss.
Organization is planning for the future : Your organization is planning for the future and wants to ensure there are enough assets to add a new rehab center in the next few years.
What is united maximized utility : Suppose pg = $25 million and pr = $20 million. What is United's maximized utility? How many GE engines do they purchase?
What is your working diagnosis : What additional information would you like to collect?What is your working diagnosis?What are the contributing factors to this potential diagnosis?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd