
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
![Write a main program that does the following:
Declares a one dimensional array A[ 6] of type int.
Declares a one dimensional array B[6]- (13, 6, 91, -8, 25, 62).
Prints both arrays.
• Swaps the elements of A and B.
• Prints both arrays.
Sample Input/output
Enter element nunber 1 of the first array: 51
Enter element nunber 2 of the first array: -76
Enter elenent nunber 3 of the first array: 23
Enter element number 4 of the first array: 15
Enter element number 5 of the first array: -35
Enter element number 6 of the first array: 78
s**** Befor swaping the tuo arrays *****
Elenents of array A are: 51 -76 23 15 -35
Elenents of array B are: 13
***** After swaping the two arrays *****
Elenents of array A are: 13 6
Elenents of array B are:
6 91 -8
78
62
25
91
23
-8
25
15
-35
62
78
51
-76](https://content.bartleby.com/qna-images/question/b6e6da82-f0f4-4881-ab84-98062460ae42/fca5210c-9973-4571-ae8c-72acbf510ea1/cw7b0le_thumbnail.png)
Transcribed Image Text:Write a main program that does the following:
Declares a one dimensional array A[ 6] of type int.
Declares a one dimensional array B[6]- (13, 6, 91, -8, 25, 62).
Prints both arrays.
• Swaps the elements of A and B.
• Prints both arrays.
Sample Input/output
Enter element nunber 1 of the first array: 51
Enter element nunber 2 of the first array: -76
Enter elenent nunber 3 of the first array: 23
Enter element number 4 of the first array: 15
Enter element number 5 of the first array: -35
Enter element number 6 of the first array: 78
s**** Befor swaping the tuo arrays *****
Elenents of array A are: 51 -76 23 15 -35
Elenents of array B are: 13
***** After swaping the two arrays *****
Elenents of array A are: 13 6
Elenents of array B are:
6 91 -8
78
62
25
91
23
-8
25
15
-35
62
78
51
-76
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 2 images

Knowledge Booster
Similar questions
- 1. Array splitting in Java Create an integer array with 10 integer numbers, initialize the array arbitrarily but make sure there are both positive and negative integers. Then generate two arrays out of the original array, one array with all natural numbers (positive numbers or zeros) and another one with all negative numbers. Print out the number of elements and the detailed elements in each array.arrow_forwardProblem 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_forwardTake arr as any integer array of any size.arrow_forward
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY