
Programming in C
4th Edition
ISBN: 9780321776419
Author: Stephen G. Kochan
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Question
Chapter 7, Problem 14E
7.10
Program Plan Intro
Modified version of the exercise 7.10 with the global variables:
Program Plan:
- Include required header files.
- Give the function prototype.
- Declare the variable “n” and “val” as global variable
- Define the main function,
- Get the number from the user.
- Call the function “prime()”.
- Check whether “val” equals to “1”.
- Print the corresponding statement.
- Otherwise, if the condition fails,
- Print the corresponding statement.
- Definition for the function “prime()”,
- Declare the variable “i”.
- Use for loop to check the condition.
- Check whether the remainder equals to 0.
- Return the value “0”.
- Return the value “1”.
- Check whether the remainder equals to 0.
- Use for loop to check the condition.
- Declare the variable “i”.
a)
Program Plan Intro
Modified version of the exercise 7.12(a) with the global variables:
Program Plan:
- Include required header files
- Declare and initialize the array values globally
- Declare the array “Arr_2” globally.
- Definition for the function “isTrans(int A[4][5], int B[5][4])”
- Declare the variable “k” and “l”.
- For loop to check whether “k” is less than “4”
- For loop to check whether “j” is less than “5”
- Condition to check if both the elements in the array are not equal.
- Return the value “0”.
- Return the value “1”.
- Condition to check if both the elements in the array are not equal.
- Definition for the function “transposeMatrix(int A[4][5], int B[5][4])”
- Declare the variable “k” and “l”.
- For loop to check whether “k” is less than “4”
- For loop to check whether “j” is less than “5”
- Condition to check if both the elements in the array are equal.
- Return the value “0”.
- Condition to check if both the elements in the array are equal.
- Check whether “isTrans(A,B)” equals to 1.
- For loop to check whether “k” is less than “5”
- For loop to check whether “l” is less than “4”
- Print the element.
- Print new line.
- For loop to check whether “l” is less than “4”
- Otherwise, print the corresponding statement inside “else” clause.
- For loop to check whether “k” is less than “5”
- Define the main function
- Call the function “transpose()” by passing the array.
- Return the value “0”.
b)
Program Plan Intro
Modified version of the exercise 7.12(b) with the global variables:
Program Plan:
- Include required header files
- Definition for the function “isTrans(int A[row][col], int B[row][col])”
- Declare the variable “k” and “l”.
- For loop to check whether “k” is less than “row”
- For loop to check whether “j” is less than “col”
- Condition to check if both the elements in the array are not equal.
- Return the value “0”.
- Return the value “1”.
- Condition to check if both the elements in the array are not equal.
- Definition for the function “t(int A[row][col], int B[row][col])”
- Declare the variable “k” and “l”.
- For loop to check whether “k” is less than “row”
- For loop to check whether “j” is less than “col”
- Condition to check if both the elements in the array are equal.
- Return the value “0”.
- Condition to check if both the elements in the array are equal.
- Check whether “isTrans(A,B)” equals to 1.
- For loop to check whether “k” is less than “col”
- For loop to check whether “l” is less than “row”
- Print the element.
- Print new line.
- For loop to check whether “l” is less than “row”
- Otherwise, print the corresponding statement inside “else” clause.
- For loop to check whether “k” is less than “col”
- Define the main function
- Declare and initialize the array values.
- Declare the array “Arr_2”.
- Call the function “transpose()” by passing the array.
- Return the value “0”.
7.13
Program Plan Intro
Modified version of the exercise 7.13 with the global variables:
Program Plan:
- Include required header files.
- Declare and initialize the array as global.
- Declare the variable “n” as global variable.
- 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
- 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 solution
Students have asked these similar questions
Draw an ERD that will involve the entity types: Professor, Student, Department and Course. Be sure to add relationship types, key attributes, attributes and multiplicity on the ERD.
Draw an ERD that represents a book in a library system. Be sure to add relationship types, key attributes, attributes and multiplicity on the ERD.
2:21 m
Ο
21%
AlmaNet
WE ARE
HIRING
Experienced Freshers
Salesforce
Platform
Developer
APPLY NOW
SEND YOUR CV:
Email: hr.almanet@gmail.com
Contact: +91 6264643660
Visit: www.almanet.in
Locations: India, USA, UK, Vietnam
(Remote & Hybrid Options Available)
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
Similar questions
- Provide a detailed explanation of the architecture on the diagramarrow_forwardhello please explain the architecture in the diagram below. thanks youarrow_forwardComplete the JavaScript function addPixels () to calculate the sum of pixelAmount and the given element's cssProperty value, and return the new "px" value. Ex: If helloElem's width is 150px, then calling addPixels (hello Elem, "width", 50) should return 150px + 50px = "200px". SHOW EXPECTED HTML JavaScript 1 function addPixels (element, cssProperty, pixelAmount) { 2 3 /* Your solution goes here *1 4 } 5 6 const helloElem = document.querySelector("# helloMessage"); 7 const newVal = addPixels (helloElem, "width", 50); 8 helloElem.style.setProperty("width", newVal); [arrow_forward
- Solve in MATLABarrow_forwardHello please look at the attached picture. I need an detailed explanation of the architecturearrow_forwardInformation Security Risk and Vulnerability Assessment 1- Which TCP/IP protocol is used to convert the IP address to the Mac address? Explain 2-What popular switch feature allows you to create communication boundaries between systems connected to the switch3- what types of vulnerability directly related to the programmer of the software?4- Who ensures the entity implements appropriate security controls to protect an asset? Please do not use AI and add refrencearrow_forward
- Could you help me to know features of the following concepts: - commercial CA - memory integrity - WMI filterarrow_forwardBriefly describe the issues involved in using ATM technology in Local Area Networksarrow_forwardFor this question you will perform two levels of quicksort on an array containing these numbers: 59 41 61 73 43 57 50 13 96 88 42 77 27 95 32 89 In the first blank, enter the array contents after the top level partition. In the second blank, enter the array contents after one more partition of the left-hand subarray resulting from the first partition. In the third blank, enter the array contents after one more partition of the right-hand subarray resulting from the first partition. Print the numbers with a single space between them. Use the algorithm we covered in class, in which the first element of the subarray is the partition value. Question 1 options: Blank # 1 Blank # 2 Blank # 3arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage

C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning

C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr

Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning

Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,

EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage