1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Marrrta [24]
3 years ago
9

Complete the program below that takes in one positive, odd, integer, n (at least 3), and prints a "diamond" shape of stars with

the widest part of the diamond consisting of n stars. For example, if the input is n=5, the output would be:
*
***
*****
***
*
If the input is n=9, the output would be:
*
***
*****
*******
*********
*******
*****
***
*
The diamond shape has rows of stars (asterisks) with and odd number of stars on each row. In the n=9 example, the rows had 1 star, 3 stars, 5 stars, 7 stars, 9 stars, 7 stars, 5 stars, 3 stars, and 1 star. Additionally, the rows with less than n stars have leading spaces to "center" the row (so that the center star of each row is directly above/below the center star of the other rows). Spaces are important in this assignment. Assume there are no trailing spaces (spaces at the end of each row). Because n must be odd and each row will have an odd number of stars, every row will have a "center" star.
Computers and Technology
1 answer:
avanturin [10]3 years ago
5 0

Answer:

n = int(input("Enter the n (positive odd integer): "))

for i in range(1, n+1, 2):

   print(i*"*")

for i in range(n-2, 0, -2):

   print(i*"*")

Explanation:

*The code is in Python.

Ask the user to enter the n

Create a for loop that iterates from 1 to n, incrementing by 2 in each iteration. Print the corresponding number of asterisks in each iteration

Create another for loop that iterates from n-2 to 1, decrementing by 2 in each iteration. Print the corresponding number of asterisks in each iteration

You might be interested in
What does it mean "Be Proactive"?
joja [24]

Answer:controlling a situation by making things happen or by preparing for possible future problems

Explanation:

4 0
3 years ago
Read 2 more answers
A _____ is a tool that helps you research information on the Internet.
never [62]

a search engine is a tool that helps you reaserch information on the internet, because it is what you use to type in the info you want to learn more about

6 0
4 years ago
Which is a function of network media?
Eduardwww [97]
The (main) function of the "network media" is the "<span> to transmit signals from device to device" because by doing this and allowing this to happen, this the signals would also send messages, and by this, it would then also be known as social media, and by this, it would be able to send pictures,  text, and etc. This would be the point of the "network media".</span>
5 0
3 years ago
Read 2 more answers
Assume that the variables gpa, deansList and studentName, have been declared and initialized . Write a statement that both adds
Alborosie

Answer:

Following are the statement which is given below:

if (gpa > 3.5)  // check the condition if gpa exceeds 3.5.

{

deansList++;  // increment of 1 in the deansList variable

cout << studentName;  // display the studentName,  

}

Explanation:

The description of the statement

  • In the if statement we check the condition of "gpa" .if  "gpa"  is greater then 3.5 then it executed the statement inside the if block otherwise nothing will be executed.
  • if control moves to the if part it adds to 1 to the deansList.
  • Finally, display the value of studentName.
3 0
3 years ago
State and explain 5 importance of ICT in an organization​
gogolik [260]

Answer:

Explanation:

ICT simply refers to Information technology and it is the digital technologies used in various sectors to help economic agents make use of information.

The importance of ICT include:

1. Communication: ICT is vital for communicating in organizations as information are spread faster and employees have quicker access to information.

2. Marketing and Sales: ICT is vital for the marketing of products as products can be advertised on social medias etc.

3. Efficiency and effectiveness: There's efficiency and effectiveness on the part of the organization as the needs of the customers are attended to quickly.

4. Improvement in management decision: ICT is also vital in the enhancement of management decisions.

5. It is also vital is the storage of vital data's in the organization.

5 0
3 years ago
Other questions:
  • 7. Glaciers have two types of deposition. Define them below:
    6·1 answer
  • Which type of element is , and what is the meaning of that element?
    14·1 answer
  • Using a for loop, print the decimal equivalents of ½, 1/3, ¼, … 1/10. Also, using a while loop, print the decimal equivalents of
    6·1 answer
  • Which of the following is a bad password? Select one: a. The acronym for the title of your favorite song plus the year it came o
    11·1 answer
  • Elisa and Josh need to access General Help. Elisa will press the F1 key. Josh will click on ? in the upper-right corner of the W
    14·2 answers
  • Your friend gave you a flash drive containing photos from a weekend event. After you copy the files, you notice a bunch of .DS f
    6·1 answer
  • 1. Empty tags do not have ___________.
    14·1 answer
  • Copyright ownership analysis starts with this principle: The ________ is the owner.
    6·1 answer
  • Mention two cables that connect the monitor to the system unit​
    9·1 answer
  • What is a common misconception about Agile and DevOps?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!