4. Show the output produced by each of the following program fragments. Assume that i, j,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
4. Show the output produced by each of the following program fragments. Assume that i, j, and k are int variables. (a) i = 6; j = 3; k = 4; printf("%d", (i+10) % k / j); (b) i = 5; j = 6; k = 7; printf("%d", (i + 5) % (j + 2) / k); (c) i8; j = ++i = 3- 2; printf("%d %d", i, j); (d) i = 3; j = 3* i-- + 2; printf("%d %d", i, j); 5. Write a C program that formats product information entered by the user. The item code can be any number between 100 and 999, price is a dollar amount up to $9999.99 and date should be in mm/dd/yyy format. Save the program in a file named as display.c, and submit the file online as your solution to this question. A session with the program should look like this: Sample Input: Enter item code: 583 Enter price: 13.5 Enter purchase date (mm/dd/yyyy): 10/24/2010 Sample output: Code Price Purchase Date 583 $ 13.50 10/24/2010 Hints: Use tabs to line up the columns. Tab stops are assumed to be eight characters apart. 4. Show the output produced by each of the following program fragments. Assume that i, j, and k are int variables. (a) i = 6; j = 3; k = 4; printf("%d", (i+10) % k / j); (b) i = 5; j = 6; k = 7; printf("%d", (i + 5) % (j + 2) / k); (c) i8; j = ++i = 3- 2; printf("%d %d", i, j); (d) i = 3; j = 3* i-- + 2; printf("%d %d", i, j); 5. Write a C program that formats product information entered by the user. The item code can be any number between 100 and 999, price is a dollar amount up to $9999.99 and date should be in mm/dd/yyy format. Save the program in a file named as display.c, and submit the file online as your solution to this question. A session with the program should look like this: Sample Input: Enter item code: 583 Enter price: 13.5 Enter purchase date (mm/dd/yyyy): 10/24/2010 Sample output: Code Price Purchase Date 583 $ 13.50 10/24/2010 Hints: Use tabs to line up the columns. Tab stops are assumed to be eight characters apart.
Expert Answer:
Related Book For
Intro To College Math Basic Arithmetic Geometry Algebra Probability And Stats
ISBN: 9781097384310
1st Edition
Authors: Nathan Frey
Posted Date:
Students also viewed these programming questions
-
Give Correct ANSWERS Human-Computer Interaction (a) If you had been one of the original inventors of the WIMP interface, and engineers on the technical team had been sceptical about the advantages...
-
: (i) What data structures are maintained by the page manager. (ii) What happens when a machine performs a read operation to a page. (iii) What happens when a machine performs a write operation to a...
-
The United Arab Emirates (UAE) is unique in that expatriates constitute more than 80 per cent of the population. As the country continues to grow and accept foreigners at an astounding pace, Emiratis...
-
The controller of Chittenango Chain Company believes that the identification of the variable and fixed components of the firm's costs will enable the firm to make better planning and control...
-
An emergency call service centre keeps records of emergency telephone calls. A study of 150 five-minute time intervals resulted in the following distribution of number of calls. For example, during...
-
Harold Fail owned a plot of land in Georgia known as Ebenezer Landing, where he operated a public boat ramp and parking lot. In 1999, Fail and Steve Bodiford entered into an oral agreement...
-
Myrtle Air Express decided to offer direct service from Cleveland to Myrtle Beach. Management must decide between a full-price service using the companys new fleet of jet aircraft and a discount...
-
Mr. Smith, a high school teacher in Gander, decided to quit his current job and opened a private tutorial firm. He gave up his $38,940 a year job as a teacher. He used $27,500 of his savings that...
-
Your company is considering investing in its own transport fleet. The present position is that carriage is contracted to an outside organization. The life of the transport fleet would be five years,...
-
13) MNO a One Person company (OPC) was incorporated during the year 2015-16 with an authorised capital of ` 45 lakhs (4.5 lakhs shares of `10 each). The capital was fully subscribed and paid up....
-
Lowell Inc. reported $12,500 of sales and $7,025 of operating costs (including depreciation). The company had $18,750 of investor-supplied operating assets (or capital), the weighted average cost of...
-
If you own 13,000 shares of stock of Nike and it pays a dividend of $0.26 per share, then what is the total dividend you will receive? The total dividend that you will receive is $...
-
Consider a European put option on a non-dividend-paying stock. The current stock price is $69, the strike price is $70, the risk-free interest rate is 5% per annum, the volatility is 35% per annum...
-
You have $258,521 to invest in a stock portfolio (this amount is your original wealth). Your choices are Stock H, with an expected return of 15.28 percent, and Stock L, with an expected return of...
-
2 Problem 1) (20 points) Describe the principle of operation of the following mechanisms and give an example application for each one. Operation: Bevel Gear Rack and Pinion Cam and Follower Four-Bar...
-
an assembly plant buys leather tops and soles from its suppliers. The leather tops have no color on them when bought. The assembly plant first dies the leather with colors like black, beige, brown...
-
What types of questions can be answered by analyzing financial statements?
-
Name the polygon
-
State if each pair of ratios forms a true proportion. 5 10 8 14
-
Find the missing angle. 40 81 71 V 75
-
Professor Ray C. Fair's voting model was introduced in Exercise 2.23. He builds models that explain and predict the U.S. presidential elections. See his website at...
-
In the STAR experiment (Section 7.5.3), children were randomly assigned within schools into three types of classes: small classes with 13-17 students, regular-sized classes with 22-25 students, and...
-
Many cities in California have passed Inclusionary Zoning policies (also known as below-market housing mandates) as an attempt to make housing more affordable. These policies require developers to...
Study smarter with the SolutionInn App