Check if each category has a parent:
foreach( ( get_the_category() ) as $category ) {
if( $category->category_parent != 0 ):
echo $category->cat_name . ' is a child category ';
else:
echo $category->cat_name . ' is a parent category ';
endif;
}