I tried to solve this below program but I don't know how to find perfect square inside the given number. I don't know how to approach this problem. plz help me solve the problem.
Program:-
Write a C program to get a number from user and find the perfect square inside the number and print them in ascending order.
Expeccted Output:-
User  :- 4673681
Result:- 1,4,36,.81
User  :- 1625649
Result:- 1,16,25,49,64,256,625.
I wrote the program like below, here, what I done is? I initialized array with some values and make a value as perfect square and then I sorted as a ascending order finally.But, what I expected is totally different. see the above expected output examples for better understanding.
#include<stdio.h>
int main()
{
    int a[10]={4,6,3,9,7,2,8};
    int i,j,m=8,temp;
   // printf("Enter the elements:");
    //scanf("%d",&m);
    for(i=0;i<m;i++)
    {
        a[i]= a[i]*a[i];
    }
    for(i=0;i<m-1;i++)
    {
        for(j=i+1;j<m;j++)
        {
            if(a[i]>a[j])
            {
                temp = a[i];
                a[i] = a[j];
                a[j] = temp;
            }
        }
    }
    printf("ascending orders:\n");
    for(i=0;i<m;i++)
    {
        printf("%d\n",a[i]);
    }
}
 
    