Programming in C
4th Edition
ISBN: 9780321776419
Author: Stephen G. Kochan
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 7, Problem 13E
Program Plan Intro
Program Plan:
- Include required header files
- Definition for the function “sort()”.
- Declare the variables.
- Condition to check the “i<n-1”.
- Condition to check the “j<n”.
- Check whether to sort in increasing order.
- Assign “a[i] ” to “temp”.
- Assign “a[j] ” to “a[i]”.
- Assign “a[j]” to “temp”.
- Check whether to sort in decreasing order.
- Assign “a[i]” to “temp”.
- Assign “a[j] ” to “a[i]”.
- Assign “a[j]” to “temp”
- Check whether to sort in increasing order.
- Condition to check the “j<n”.
- Define the main function
- Declare the required variable
- Initialize the array.
- Print the statement.
- Loop to traverse the array.
- Print the element.
- Call the function “sort()”.
- Loop to traverse the array.
- Print the element.
- Print new line
- Return the value “0”.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
The Philippine Stock Exchange (PSE) is the national stock market of the Philippines. As of 1 January 2022, there are 278 listed companies in PSE.
Write a C++ program that asks user input stock symbol, checks whether the input symbol is included in the listed companies in the Philippine Stock Exchange market, and outputs the position of the listed company in the array. Use linear search algorithm.
Note: Use this list of stock symbols attached in the table.
S.No.
Symbol
1
2GO
2
HOUSE
3
BRN
4
ANS
5
ABA
6
AEV
7
AP
8
AR
9
ABS
10
ABSP
11
ACEN
12
ACEX
13
ACE
14
ANI
15
ALLDY
16
HOME
17
AGI
18
FOOD
19
ACR
20
APVI
21
ALHI
22
APO
23
APC
24
APX
25
APL
26
ARA
27
AREIT
28
ALCO
29
AAA
30
AUB
31
ABG
32
ATI
33
AT
34
ATN
35
AB
36
AXLM
37
AC
38
ALI
39
ALLHC
40
BPI
41
BSC
42
BLFI
43
BDO
44
BEL
45
BC
46
BCOR
47
BH
48
BLOOM
49
BMM
50
BHI
51
BKR
52
CEB
53
CHI
54
CLI
55
CHP
56
CAT
57
CEU
58…
Please do only A and B
In this program, you should define an array of 10 elements in your data segment with these values:? = {11, 12,−10, 13, 9, 12, 14, 15,−20, 0}a. Write a function which finds the maximum value of this array.b. Write another function which calculates the summation of this array.c. Call these functions in your main program, and print the outputs of these functions to theuseri. “The maximum is 15”ii. “The summation is 56”d. What is the address that has been used by the simulator for this array?
Using “Def” keyword write a function that returns the Max element of the given array elements (The function name will be MaxofArrayElements)
Not: Write some print functions to see the outputs inside each function. (Python programming language)
(Solution must be like first image but max of arrays.it shouldnt be like second image)
Chapter 7 Solutions
Programming in C
Ch. 7 - Type in and run the 17 programs presented in this...Ch. 7 - Prob. 2ECh. 7 - Modify Program 7.8 so that the value of e is...Ch. 7 - Modify Program 7.8 so that the value of g is...Ch. 7 - Prob. 6ECh. 7 - Write a function that raises an integer to a...Ch. 7 - Prob. 8ECh. 7 - The least common multiple (1cm) of two positive...Ch. 7 - Prob. 10ECh. 7 - Write a function called a that takes two...
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
- In statistics the median of a set of values is the value that lies in the middle when the values are arranged in sorted order. If the set has an even number of values, then the median is taken to be the average of the two middle values. Write a function that determines the median of a sorted array. The function should take an array of numbers and an integer indicating the size of the array and return the median of the values in the array. You may assume the array is already sorted. Use pointer notation whenever possible.arrow_forward2. Modify the previous program such that function will print elements in reverse order. Enter Array elements: 20 8 71 51 53 Array elements: 35 51 71 8 20 a. Insert a copy of your code. b. Take a screenshot for your program output.arrow_forwardPerform matrix multiplication of 2D array. The program should meet the matrix multiplication rule i.e. number of columns of first matrix should be equal to the number of rows of second matrix. The input of two matrices A and B is given by user. Use function approach to handle array multiplication.arrow_forward
- Write a function that inputs N (assume N<30), and N integers into a 1-Dimensional array. Itwill find and display how many times the array elements are repeated in the array.Sample Run:Enter N (N<30): 6Enter 6 integers: 1 2 1 1 7 71 occurs 3 times2 occurs 1 times7 occurs 2 timesarrow_forwardPlease note global variables are not allowed to use in this assignment except of global constants. Find Median. In statistics, the median of a set of values is the value that lies in the middle when the values are arranged in sorted order. If the set has an even number of values, then the median is taken to be the average of the two middle values. Write a C++ program that determines the median of a sorted array. In the main function, Declare and initialize two arrays. One array must contain an even number of values, for example {91, 71, 67, 78, 76, 82, 100, 89}. The other array must contain an odd number of values, for example {76, 71, 78, 67, 82}. Call a function named sortArray to sort the values in each array in ascending order. should take an array of numbers and an integer indicating the size of the array as the arguments, and sort the array in ascending order. This function does not return any value. Call another function named findMedian to find the median of the values in…arrow_forwardWrite a function checks if an array has any duplicates by taking each element, then iterating over the whole array to see if the element is there(use nested loop)arrow_forward
- Using “Def” keyword write a function that returns the min element of the given array elements (The function name will be MinofArrayElements) Not: Write some print functions to see the outputs inside each function. (Python programming language)arrow_forwardWrite a function to sort data (in increasing order) in an array using a. pass by value b. and pass by reference. Note: it's a c++ programarrow_forwardGiven a sorted array of integers, write a function to remove duplicates and return the new length of the array.arrow_forward
- Write a function to sort data (in increasing order) in an array using a. pass by value b. and pass by reference Note it is a c++ program try to solve in c++ language and in pass by reference use '&' instead of '* ' if possible I did not use it before.arrow_forwardWrite a function that returns trueif the product of an array is divisible by the sum of that same array. Otherwise, return false. Example: divisible([3, 2, 4, 2]) →false WRITE IN PYTHON PLEASEarrow_forwardUsing “Def” keyword write a function that returns the Max element of the given array elements (The function name will be MaxofArrayElements) Not: Write some print functions to see the outputs inside each function. (Python programming language)arrow_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