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
Concept explainers
Question
Program in C
Write a program that does the following:
- Asks user for a positive integer, N.
- Creates a 1-dimensional integer array of length N.
- Stores the squares of all integers from 1 to N in the array.
- Prints out all N values of the array.
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
- Lw//. Two-Dimensional ArrayInstruction:Create a java program that generates elements (randomly from 10 – 75) of a 2-dimensional array (5x5) using the Random Class then perform the following:1) Output the array elements2) Output the sum of prime numbers in the array3) Output the elements in the main diagonal.4) Output the sum of the elements below the diagonal.5) Output the sum of the elements above the diagonal.6) Output the odd numbers below the diagonal.7) Output the even numbers above the diagonal. NOTE: Please do not use the array methods available on the internet. Use the for loop, while loop or do-while loop statement in your codes..arrow_forwardHello, can you please help me do this Java program using the two attached pics, here are the instructions: Problem Description:Use a one-dimensional array to solve the following problem:Request five unique numbers, each of which is between 10 and 100, inclusively. As each number is read,display it only if it is not a duplicate of a number already read, providing for the “worst case”, which is allfive numbers are different.Use the smallest possible array to solve this problem. Display the complete set of unique values inputafter the user inputs each new value.Programming Steps1. Download the provided programs Project7_UniqueNumbers.java andProject7_UniqueNumbersTest.java2. Complete the programs to use arrays in your compilera. There are nine (9) TODOsi. Seven (7) in Project7_UniqueNumbers.javaii. Two (2) in Project7_UniqueNumbersTest.javab. You should add necessary statements/structures to the given programs as instructed inthe comments3. Debug and run your applicationarrow_forwardIn C Programming Write a main function that declares an array of 100 ints. Fill the array with random values between 1 and 100. Calculate the average of the values in the array. Output the average.arrow_forward
- In c++, Declare a constant “ SIZE = 5 ” Declare an array of ints , of size SIZE . Initializethat array to have the values 10, 12, 15, 19, 6 .– Write a loop that calculates and prints out the minimum value of the array.– Write a loop that calculates and prints out the maximum value of the array.– Write a loop that calculates and prints out the average value of the array.arrow_forwardprogramming used: javaarrow_forward2arrow_forward
- Problem Description - JAVA PROGRAMMING Use a Two-dimensional (3x3) array to solve the following problem: Write an application that inputs nine numbers, each of which is between 1 and 10, inclusive. Display the array after the user inputs each value. Rotate/flip the array by changing places. Make the rows columns and vice versa. You have to move the elements to their new locations. Remember to validate the input and display an error message if the user inputs invalid data. Documentation and the screenshot(s) of the results. Example: 1 2 3 4 5 6 7 8 9 the result will be : 1 4 7 2 5 8 3 6 9arrow_forwardPrompt: In Python language, write a function that applies the logistic sigmoid function to all elements of a NumPy array. Code: import numpy as np import math import matplotlib.pyplot as plt import pandas as pd def sigmoid(inputArray): modifiedArray = np.zeros(len(inputArray)) #YOUR CODE HERE: return(modifiedArray) def test(): inputs = np.arange(-100, 100, 0.5) outputs = sigmoid(inputs) plt.figure(1) plt.plot(inputs) plt.title('Input') plt.xlabel('Index') plt.ylabel('Value') plt.show() plt.figure(2) plt.plot(outputs,'Black') plt.title('Output') plt.xlabel('Index') plt.ylabel('Value') plt.show() test()arrow_forwardCODE IN JAVA design a program that grades arithmetic quizzes as follows: (Use the below startup code for Quizzes.java and provide code as indicated by the comments) 1. Ask the user how many questions are in the quiz. 2. Use a for loop to load the array. Ask the user to enter the key (that is, the correct answers). There should be one answer for each question in the quiz, and each answer should be an integer. They can be entered on a single line, e.g., 34, 7, 13, 100, 8 might be the key for a 5-question quiz. You will need to store the key in an array called "key". 3. Ask the user to enter the student's answers for the quiz to be graded. There needs to be one answer for each question. Note that each answer can simply be compared to the key as it is entered. If the answer is correct, add 1 to a correct answer counter. need this in a separate for loop from the loop used to load the array. 4. When the user has entered all of the answers to be graded, print the number correct…arrow_forward
- can you please write this in java.util.scanner form and can you make it so i can copy and past it, thank you.can you please write this in java.util.scanner form and can you make it so i can copy and past it, thank you. 2D Array OperationsWrite a program that creates a two-dimensional array initialized with test data. Use anyprimitive data type that you wish. The program should have the following methods:• getTotal. This method should accept a two-dimensional array as its argument andreturn the total of all the values in the array.• getAverage. This method should accept a two-dimensional array as its argument andreturn the average of all the values in the array.• getRowTotal. This method should accept a two-dimensional array as its first argumentand an integer as its second argument. The second argument should be the subscriptof a row in the array. The method should return the total of the values in thespecified row.• getColumnTotal. This method should accept a two-dimensional array…arrow_forward30arrow_forwardpython: numpy def coupons(my_list, on_sale, prices): ''' QUESTION 5 It's the time of week to go grocery shopping again! Given three arrays, one of what's on sale, one of your own list, and one of the prices, return an array of the items on your list that are on sale and more than five dollars. You have MORE coupons than you have groceries on your list- make sure to only use the coupons that correspond to your list. THIS MUST BE DONE IN ONE LINE Hint: use masking and slicing Args: my_list(np.array) on_sale(np.array) prices(np.array) Return: np.array >>> my_list = np.array(["eggs", "2% milk", "green onions", "whole wheat bread", "onions", "spinach", "peanut butter", "boxed spaghetti", "salt and vinegar chips", "alfredo sauce"]) >>> on_sale = np.array([True, False, True, True, True, True, False, False, False, True, False, True, False])…arrow_forward
arrow_back_ios
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