Here is what I need to know. I want to generate the following pattern in a C (not C++) console app that prints out EXACTLY as shown.
*
**
***
****
*****
******
*******
********
*********
**********
......
Well... you get the idea. Thanks!
How do you make an asterisks pattern in the C (not C++) language?
Are you in your first c class? Use a nested for loop. The first one should be for the row and the second one for the column.
Reply:i dont know, nor do i care!
Reply:This should do it:
int _tmain(int argc, _TCHAR* argv[])
{
for ( int count = 1; count %26lt; 11; count++)
{
fprintf( stdout, "%-10.*s\n", count, "**********" );
}
return 0;
}
Reply:suppose the number of lines to print is N the code is
for (i=1;i%26lt;=N;i++){
for(j=1;j%26lt;=i;j++){
printf("*");
}
printf("\n");
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment