Pages

Saturday 22 October 2011

Nested loop


Hi and salam to all ! I would like to share with you guys about my programme regarding to the nested loop :

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

int main( void )
{
    int size;
    int row;
    int star;

    printf( "Enter size of triangle:\n " );
    scanf( "%d", &size );

    row = 1;

    while( row <= size )
    {
        star = 1;

        while( star <= row )
        {
            printf( "*" );
            star++;
        }

        printf( "\n" );

        row++;
    }

    system( "PAUSE" );
    return 0;
}

No comments:

Post a Comment