/************************************************************************
*																		*
* ders 10 ornekleri - Deniz Demiray										*
* string sayinin karesini alan program									*
* derlemek icin gcc -o program_ismi 7.c									*
*																		*
************************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

int main()
{
	char sentence[70], number_str[10], *ptr;
	int number, temp=0;
	
	
	printf("Detect the number in a string:\n");
	printf("Calculate the square of the number:\n\n");
	
	printf("Enter the string:\n");
	gets(sentence);
	
	ptr=sentence;
	
	
	while (*ptr != '\0') {
		
		if(isdigit(*ptr)) {
			
			number_str[temp]=*ptr;
			temp++;
		}
		 
		ptr++;
    }
	
	printf("The number: %s\n", number_str);
	number = atoi (number_str);
	
	printf("Square of the number: %d\n", number * number);
	
	system("pause");
	
	return 0;
}
