What is output from the following segment of code

Assignment Help C/C++ Programming
Reference no: EM13809613

1. What is output from the following segment of code? (note: this is a code segment, not a complete program.)

int x;

for (x= 1; x <= 5; x++)

printf ("%i ", x+1)

2. Using the variable declarations below, what gets output once the printf statement shown below is executed:

int num1 = 2;

int num2 = 3;

printf ("%i", num1 + num2);

3. What is output from the following code segment:

int a, b;

for (a = 1; a <= 2; a++)

for (b = 1; b <= 3; b++)

printf("%i ", a + b);

4. Write a program that asks the user to enter how many hot dogs they wish to purchase. It will then compute the price of that many hot dogs at $1.50 each, compute the meals tax of 5%, and display the number of hot dogs and the original price, the meals tax amount, and the total amount due on three separate lines with appropriate labels. (No header or comments should be inserted in the code! No trap loops or any loops are needed, it will result in deductions!).

5. Assume that a, b, c, and d are all variables of type int. Also assume that: a = 2, b = 3, and c = 5. What value is stored in variable d after the following C statement is executed:

d = (a + b) + c * 5;

6. How many times would the following loop execute?

for (x = 2; x <= 10; x += 2)

printf ("I am in the loop!\n");

7. In C, for variables of type int we use %i as the format specifier in printf and scanf statements. What do we use as the format specifier for variables of type float, if we want to output the floating point value, showing 3 decimal places?

8. Assume x is a variable of type int. Which for loop below would output the following: (Choose all that apply.)

10

20

30

40

50

a. for (x = 1; x <= 5; x++)

printf ("%i\n", x * 10);

b. for (x = 1; x <= 50; x++)

printf ("%i\n", x);

c. for (x = 1; x <= 5; x++);

printf ("%i\n", x);

d. for (x = 10; x <= 50; x = x + 10)

printf ("%i\n", x);

e. for (x = 9; x <= 49; x = x + 10)

printf ("%i\n", x + 1);

Reference no: EM13809613

Questions Cloud

Weighted average cost of capital : The Black Bird Company plans an expansion. The expansion is to be financed by selling $32 million in new debt and $71 million in new common stock. The before-tax required rate of return on debt is 11.74% percent and the required rate of return on equ..
Assume annual compounding : You are a financial analyst with the U. S.- based MNC Prod & Push, which sells consumer products around the world. You report directly to the CFO. You have been assigned the task of negotiating with bankers on certain forward contracts involving the ..
Present value of an annuity stream-time value money : This assessment has two parts both addressing the subject of Time Value Money (TVM). Both parts should be submitted in the same paper. The main TVM problems relating to healthcare are: a) present value of a lump sum b) present value of an annuity str..
Discuss the neolithic revolution : Discuss the Neolithic Revolution
What is output from the following segment of code : What is output from the following segment of code? (note: this is a code segment, not a complete program.) What is output from the following code segment
Expected cash flow related to this debt issue : FRN and Expected Cash Flows. A U. S. firm issues a three- year FRN with a face value of $ 250,000. The coupon is set at LIBOR plus 50 basis points and is paid annually. The coupon rate is set at the beginning of the year. The firm’s CEO notes that th..
What is after-tax cost of capital for this debt financing : Great Seneca Inc. sells $100 million worth of 21-year to maturity 8.91% annual coupon bonds. The net proceeds (proceeds after flotation costs) are $988 for each $1,000 bond. The firm's marginal tax rate is 40%. What is the after-tax cost of capital f..
Examine the culture of the hewlett packard organization : Examine the culture of the selected organization. Explain how you determined that the selected organization showed the signs of the culture that you have identified.
Write the economic analysis section of a business proposal : Write the economic analysis section of a business proposal. This will include statements about the market structure and the elasticity of demand for the good or service, based on text book principles

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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