*
**
***
****
*****
******
*******
********
*********
**********
**********
*********
********
*******
******
*****
****
***
**
*
*
**
***
****
*****
******
*******
********
*********
********** (this is supposed to be a right triangle _|)
And the last one is the same way except the right angle is this way _
| )
#include <stdio.h>
#define SIZE 10
int main( void )
{
int n[SIZE] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int b[SIZE] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
int i;
int j;
printf( "\n(A)\n" );
for ( i=0; i < SIZE; i++ ){
for ( j = 1; j <=n[ i ]; j++ ){
printf( "%c", '*' );
}
printf( "\n" );
}
printf( "\n(B)\n" );
for ( i=0; i < SIZE; i++ ){
for ( j = 1; j <=b[ i ]; j++ ){
printf("%c", '*' );
}
printf( "\n" );
}
return 0;
}
*edit: Please use code tags in the future, thanks!
This post has been edited by Martyr2: 27 April 2008 - 07:49 PM

New Topic/Question
Reply




MultiQuote









|