#include <stdio.h>
#include <math.h>

// i;q(char*n){double m=0;while(*n)m+=*n++-48;m=sqrt(m)-(int)sqrt(m);return !m;}
// s(char**n,int s){i=-1;while(++i<s)if(q(n[i]))printf("%s\n",n[i]);}

int q(char*n)
{
	double m=0;
	
	while(*n) // sum digits
		m+=*n++-48;
	
	// get the decimal part
	m=sqrt(m)-(int)sqrt(m);
	
	// true if decimal part is zero
	return !m;
}

// input is text, can be a file
void s(char**n, int s)
{
	int i=-1;
	
	while(++i<s) // for each number in input
		if(q(n[i])) // if is square
			printf("%s\n",n[i]); // output is terminal
}

int main(void)
{
	char* test[] = {"1","2","4", "9","16","25","1111"};
	s(test, sizeof(test)/sizeof(test[0]));
	return 0;
}
