You can use either
<?php query_posts('category_name=CATEGORYNAME&showposts=5');
while (have_posts()) : the_post();
// do whatever you want
?>
<b><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a>
<?php
endwhile;
?>
or
<?php $posts = get_posts('category=7,21&numberposts=5&showposts=5'); foreach($posts as $post) { ?>
<?php } ?>
or
<?php
// ID here is cate id
$my_query = new WP_Query('cat=[ID]&post_count=5');
while ($my_query->have_posts()) : $my_query->the_post();
// do whatever
endwhile
?>
Still if you have not got your solution, please elaborate your question.