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

  Write a c matrix multiplication program which you can

write a c matrix multiplication program which you can instrument to monitor and measure execution time as a function of

  Calculate the number of elapsed days

Write a function that calculates the number of elapsed days between two dates. For example the days between Feb 3, 1970 and June 21, 1980? Becareful for the Leap year imediately.

  Quiz on c coding

Which of the following statements is incorrect

  Main program should instantiate an instance

The main program should instantiate an instance of the class Rectangle and then make calls to the member functions to input the data and output the results

  Program in c languagenbspuse microsoft visual studio the

program in c languagenbspuse microsoft visual studio the attachment has the program requirements and the text file has

  Implement a function which finds the largest number

Write a function named largest which will receive the array as input and return the variable LargestNumber.

  String converter

String Converter: Implement a program that asks the user to input up to 20 strings (stopping when the user inputs 0). Store these strings in a 2-dimensional array. Replace all the characters that are upper-cased to their lower-case equivalent.

  What will be the value of xafter executing the above switch

If x = 3, then what will be the value of xafter executing the above switch statement?

  Write a program that first prompts the user

Write a program that first prompts the user (repeatedly , if necessary) to supply a single digit(0,1,2..9) The program should repeatedly prompt the user for integer values until a sentinel value of 0 is entered to terminate the program.

  One time for the entire number set

You must run your program one time for the entire number set. Test for EOF (or use the function feof()) to know when to stop processing. You are to determine if each integer read is prime or not, and output the result to stdout

  What do the loops print

What do the following loops print? Work out the answer by tracing the code, not by using the computer. a. int s = 1; for (int n = 1; n

  Implement a class that can be used to keep track

Specify, design, and implement a class that can be used to keep track of position of a point in three-dimensional space. For example consider the point drawn at the topof the next coloumn. The point shown there has three coordinates;

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