Write a program to print a diamond with a specified size using asterisks (*). The program...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program to print a diamond with a specified size using asterisks (*). The program receives an odd positive integer as the diagonal length of the diamond, which represents the number of asterisks (*) in the middle row. As diamonds are symmetric, the number of asterisks (*) in rows from top to bottom should be 1,3,5...5,3,1. Expected output is as follows: Expected Outcomes: Example 1 Enter the diagonal length: Example 2 Enter the diagonal length: 11 ****** ****** ******* ******* ***** *** Example 3 Enter the diagonal length: 4 Please enter an odd positive number! -1 Please enter an odd positive number! *** Write a program to print a diamond with a specified size using asterisks (*). The program receives an odd positive integer as the diagonal length of the diamond, which represents the number of asterisks (*) in the middle row. As diamonds are symmetric, the number of asterisks (*) in rows from top to bottom should be 1,3,5...5,3,1. Expected output is as follows: Expected Outcomes: Example 1 Enter the diagonal length: Example 2 Enter the diagonal length: 11 ****** ****** ******* ******* ***** *** Example 3 Enter the diagonal length: 4 Please enter an odd positive number! -1 Please enter an odd positive number! ***
Expert Answer:
Related Book For
Operating Systems Internals And Design Principles
ISBN: 9781292214290
9th Global Edition
Authors: Stallings William
Posted Date:
Students also viewed these programming questions
-
The Julian calendar was a reform of the Roman calendar introduced by Julius Caesar in 46 BC (708 AUC). It took effect in 45 BC (709AUC). It was the predominant calendar in most of Europe, and in...
-
What legal and ethical considerations should a counsellor be aware of when working with self-harm and suicidal behaviours?
-
The labor force participation rate is increasing in Japan because... a) there are fewer unemployed people b) the working age population is increasing c) retirement ages are increasing d) more women...
-
What is the composition, in atom percent, of an alloy that consists of 5.5 wt% Pb and 94.5 wt% Sn?
-
A recursive method is a method that _________________. a. Contains no loops b. Is executed at least twice during program execution c. Calls itself d. Calls no other methods
-
Refer to your answers in E4-28A. In addition to the manufacturing overhead costs, the following data are budgeted for the companys Standard and Deluxe models for next year: Requirements: 1. Compute...
-
Pevnick Inc. began operations as a detective agency on January 1, 2015. The trial balance columns of the worksheet for Pevnick Inc. at March 31 are as follows. Other data: 1. Supplies on hand total...
-
Question four (20mks) Explain how the following are fundamental in appraising income property A. potential gross income (16mks) B.Net operating income (4mks) Question five (20mks) Explain the theory...
-
Jenny Atkinson is reviewing employment offers. The employment offer from ILU, Inc. includes private health insurance that ILU, Inc. will purchase on her behalf. ILU Inc. will have to pay a $1,840...
-
What are the Benefits to working in a Accounting government job? 1What is the Compensation- Base salary, bonuses, benefits, other monetary incentives? 2What is the Work-Life Balance-Typical working...
-
On April 1 , Jiro Nozomi created a new travel agency, Adventure Travel. The following transactions occurred during the company s first month. April 2 Nozomi invested $ 4 1 , 0 0 0 cash and computer...
-
Scenario: there is a database to keep data about college students, their academic advisors, the clubs they belong to , , the moderators of the clubs, and the activities that the clubs sponsor. Assume...
-
How do our biases affect decision making? Think about the topic of ethics in light of the decision-making biases mentioned. Can our biases "cause" unethical behavior? Why or why not?
-
Wallace and Brace CPA assign a partner to screen and recommend (or decline) potential clients prior to acceptance. Discuss at least 4 specific issues which should have been considered prior to...
-
Case Study: You will role play a professional who needs to use communication to resolve a situation. Consider that you are a home warranty company that contracts home services vendors to address...
-
The following information is available for Carla Vista Corporation's pension plan for the year 2020: Plan assets, January 1, 2020 $390,000 Actual return on plan assets 17,000 Benefits paid to...
-
You are standing on the top of a building and throw a ball vertically upward. After 2 seconds, the ball passes you on the way down, and 2 seconds after that, it hits the ground below. a. What is the...
-
A system has a total of 128 frames. There are 4 processes in the system with the following memory requirements: p 1 : 45 p 2 : 75 p 3 : 33 p 4 : 135 Using the following allocation methods, compute...
-
Suppose we have four jobs in a computer system, in the order JOB1, JOB2, JOB3 and JOB4. JOB1 requires 8 s of CPU time and 8 s of I/O time; JOB2 requires 4 s of CPU time and 14 s of disk time; JOB3...
-
What is the cloud computing reference architecture?
-
Example 11.3 introduces Klein's Model I. Use the data file klein to answer the following questions. a. Estimate the investment function in equation (11.18) by OLS. Comment on the signs and...
-
Mike's Veneer Shop owns a vacuum press that requires annual maintenance. Mike has a contract to cover the maintenance expenses for the next 5 years. The contract calls for an annual payment of \(\$...
-
True or False: The Consumer Price Index typically increases faster than the Higher Education Price Index.
Study smarter with the SolutionInn App