Question
Write a MAIN function and two FUNCTIONS to compute and print the elements of a two-dimensional 30X25 integer array A which are square numbers. Hint:
Write a MAIN function and two FUNCTIONS to compute and print the elements of a two-dimensional 30X25 integer array A which are square numbers.
Hint: A square number is a positive integer that is the square of an integer, in other words, it is the product of some integer with itself. For example, 25 is a square number since, it can be written as 5*5.
Within the MAIN function:
Declare a two-dimensional 30X25 integer array A and initialize it with random numbers between 1 and 100 inclusive.
Declare also a one-dimensional integer array B with a reasonable size to hold the elements of the array A which are square numbers.
Pass the arrays A and B to the FUNCTION1 as arguments and get the return value (the size of B, the number of square elements of A stored in B) from the FUNCTION1.
Pass the array B and the size of B (returned value from the FUNCTION1) to the FUNCTION2 as arguments.
Print the array B.
Print the array B without duplicates (i.e., repeated elements will be written only once.
Within the FUNCTION1:
Read array A elements and compute and store the square elements of A into the array B.
Return the size of the array B (the number of the square elements stored in B) to the MAIN function.
Within the FUNCTION2:
Sort the array B elements in ascending order.
/******* SAMPLE OUTPUT **********************
Array B (sorted ascending order)
---------------------------------
1 1 1 1 4 4 4 4 4 4
4 4 9 9 9 9 16 16 16 16
16 16 16 16 25 25 25 25 25 25
36 36 36 36 36 36 36 36 36 49
49 49 49 49 49 49 49 49 64 64
64 64 64 64 64 81 81 81 81 81
81 81 81 81 81 81 81 100 100 100
100 100 100 100 100
Array B without duplicates
------------------------------
1 4 9 16 25 36 49 64 81 100
Process returned 0 (0x0) execution time : 0.016 s
Press any key to continue.
***********************************************/
Edit: This is a C program
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started