Add Sequential Classes to loop, WordPress

Below are to examples you will probably need the most.  Adding a sequential class to a for loop, and adding a sequential class to a while loop

For Loop

 <?php  global $post;
$cntr = 1;
                 $myposts = get_posts('category=1&numberposts=3&order=des');
                 foreach($myposts as $post) :
                 setup_postdata($post);?>
        <li class="<?php echo "post-" . $cntr; ?>"><a href="<?php the_permalink() ?>"><?php the_title() ?></a></li>
<?php $cntr++; ?>
                <?php endforeach; ?>

 

While Loop

<?php 
if ( have_posts() ) :
    $slideNumber = 1;
    while ( have_posts() ) : the_post(); ?>
<div id="slide">
<ul>
<li class="slide-<?php echo $slideNumber++; ?>">
<a href="#">stuff</a></li>
</ul>
</div>
<?php
    endwhile;
endif; ?>