
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Fast else downvote
Use only C
![Write the code for the following problems using arrays. Write what would go in the "int main(" part of the
program. For these problems, the entire program and program output is not needed. Just include what
goes in the int main() part of the program.
1. Declare an integer array named stuff with 20 elements
2. Initialize each element of the array stuff to value 100.
3. Ask the user to enter each value of the array stuff (prompt and input)
4. Print all elements of the stuff array
5. Print all elements of the array stuff in reverse order
6. Sum all elements of the array stuff
7. Determine the average of all elements in the array stuff
8. Find the largest element in the array stuff
9. Subtract 1 from every element of the stuff array.
10. Divide all even-numbered elements in the stuff array (stuff[0],stuff[2],.stuff[20]) by 5, i.e. stuff[2] =
stuff[2]/5
%3D](https://content.bartleby.com/qna-images/question/d78cc5b6-aa8b-4a01-8aad-a621831ca139/b87ab0df-a62c-4aa0-9906-f01acb3e01cd/hgfj855_thumbnail.jpeg)
Transcribed Image Text:Write the code for the following problems using arrays. Write what would go in the "int main(" part of the
program. For these problems, the entire program and program output is not needed. Just include what
goes in the int main() part of the program.
1. Declare an integer array named stuff with 20 elements
2. Initialize each element of the array stuff to value 100.
3. Ask the user to enter each value of the array stuff (prompt and input)
4. Print all elements of the stuff array
5. Print all elements of the array stuff in reverse order
6. Sum all elements of the array stuff
7. Determine the average of all elements in the array stuff
8. Find the largest element in the array stuff
9. Subtract 1 from every element of the stuff array.
10. Divide all even-numbered elements in the stuff array (stuff[0],stuff[2],.stuff[20]) by 5, i.e. stuff[2] =
stuff[2]/5
%3D
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 3 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Write this code from python to Java. # Input a positive integer x = int(input()) # Loop until x is greater than 0 while x > 0: # Output the remainder when x is divided by 2 # The remainder will be either 0 or 1 print(x %2, end='') # Divide x by 2 and assign the result to x x //= 2 # Add a new line for better readability print()arrow_forwardJava programmingarrow_forwardJAVA The loop continuation condition is the inverse of the loop termination condition. True Falsearrow_forward
- Course Level Programming Assignment - Programming a Calculator using Python In this assignment you will write a computer program from scratch using the Python programming language. This program will function as a simple calculator. Objectives • Write a simple Python program that performs arithmetic operations based on the user input Stage 1: A simple calculator Your calculator should provide the following arithmetic and control operations. • Arithmetic Operations • Addition (+) add(a,b) subtract(a,b) • Subtraction (-) • Multiplication (*) • Division (/) multiply(a,b) divide(a,b) power(a,b) remainder(a,b) • Power (^) • Remainder (%) • Control Operations o Terminate (#) o Reset ($) Write a function select op(choice) to select the appropriate mathematics function based on the users selection. The behavior of the program should be as follows: You can start • The program should ask the user to specify the desired operation…arrow_forwardPYTHON CODINGarrow_forwardNeed Python Solution Ramesh, Suresh, Mahesh, and Mukesh moved to a new town and searched for accommodations. Now this city is unlike any other city. This city is an apartment matrix and there are no roads. The only way to get around is through houses. If one of the friends passes the apartment once, the party will have to pay its full rent. From the apartment, you can go to the houses to the North, South, East, or West. Since Ramesh, Suresh, Mahesh, and Mukesh are best friends, they want to meet at least once a month. Also, all four are superstitious, so Ramesh goes West only, Suresh goes North only, Mahesh goes East only, and Mukesh goes South only. Any number of people can live in any apartment. The cost of all housing in the city is provided, some of which may be negligible. Negative costs mean that if a friend lives in or moves out of the apartment, the party will be paid an amount equal to the cost dispute. Now the goal of these four friends is to earn enough money to live in the…arrow_forward
- CODE IN C# NOT JAVA (reject if you can't do C# please): Write an application that runs 1,000,000 games of craps and answers the following questions (explain each step): How many games are won on the first roll, second roll, …, twentieth roll and after the twentieth roll? How many games are lost on the first roll, second roll, …, twentieth roll and after the twentieth roll? What are the chances of winning at craps? [Note: You should discover that craps is one of the fairest casino games. What do you suppose this means?] What is the average length of a game of craps?arrow_forwardTwo methods may terminate operations and resolve impasses:arrow_forwardl Verizon LTE 5:00 PM © 44% Done C++_Programming_Assignments... You are working for a lumber company, and your employer would like a program that calculates the cost of lumber for an order. The company sells pine, fir, cedar, maple, and oak lumber. Lumber is priced by board feet. One board foot equals one square foot that is one inch thick. The price per board foot is given in the following table: Pine 0.89 Fir 1.09 Cedar 2.26 Maple 4.50 Oak 3.10 The lumber is sold in different dimensions (specified in inches of width and height, and feet of length) that need to be converted to board feet. For example, a 2 x 4 x 8 piece is 2 inches wide, 4 inches high, and 8 feet long, and is equivalent to 5.333 board feet (2 * 4 * 8 = 64, which when divided by 12 = 5.333 board feet). An entry from the user will be in the form of a letter and four integer numbers. The integers are the number of pieces, width, height, and length. The letter will be one of P, F, C, M, O (corresponding to the five kinds…arrow_forward
- JAVA algorithm ur pseudo-code ,, top-down, stepwise refinement. Write a Java program.. Baker Co pays commision. Salesppl get $200 a wk nd 9% of their gross sales per wk. You’ve been supplied with a list of the items sold by each salesperson. The values of these items are in pic, app inputs one 1 sale ladys items sold for last wk and calculates and shows her earnings. She can sell any amntarrow_forwardPlease color the code? Identifier (RED) Expression(BLUE) Statement(Yellow) Reserved words(dark red) Please helparrow_forwardC++ Programming Ex 5-7 Let n = akak-1ak-2...a1a0 be an integer and t = a0 - a1 + a2 - ... + (-1)k ak. It is known that n is divisible by 11 if and only if t is divisible by 11. For example, suppose that n = 8784204. Then t = 4 - 0 + 2 - 4 + 8 - 7 + 8 = 11. Because 11 is divisible by 11, it follows that 8784204 is divisible by 11. If n = 54063297, then t = 7 - 9 + 2 - 3 + 6 - 0 + 4 - 5 = 2. Because 2 is not divisible by 11, 54063297 is not divisible by 11. Write a program that prompts the user to enter a positive integer and then uses this criterion to determine whether the number is divisible by 11. Example output (Program output should be in a similar format): 121 is divisible by 11 12 is not divisible by 11arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education