Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Im having a hard time writing this program for RAPTOR. I\'m not sure where to st

ID: 3860186 • Letter: I

Question

Im having a hard time writing this program for RAPTOR. I'm not sure where to start with it, it is as follows:

Write a program to load an array, Squares, with 100 numbers. Each element should contain the square of its index value. In other words, Squares[1] = 1, Squares[2] = 4, Squares[3] = 9, ..... Squares[8] = 64, and so on. Then prompt the user for a number from 1 through 10,000 and write flowchart code to check if that number is a perfect square (i.e., if the user inputs X, check to see if X is a value in the array). Use a serial search for this program. Check how many iterations of the search must be made for each number entered by the user. Provide appropriate output to tell the user whether the number input was a perfect square or not and how many iterations of the search had to be performed to find out.

Explanation / Answer

You can start the program by defining a method named squares[].

Then further with the help of for loop you can initialize the values of the array.And then with/without the help of function you can use any of the search methods.

Here is the program for this.

#include <stdio.h>
void main()
{
int squares[100],search,c;
for(int i=0;i<100;i++)
{
squares[i]=i*i;
}
printf("Enter number from 1 to 10,000 ");
scanf("%d", &search);

OUTPUT:

Enter number from 1 to 10,000

81

81 is a perfect square of 9