to write a program having output as
*
**
***
How to write a program in c using nested loops?
Just as decisions can be nested, so can loops; that is, you can place loops inside other loops
#include %26lt;stdio.h%26gt;
int main()
{
int x, y;
for(x=0;x%26lt;4;x++)
{
for(y=0;y%26lt;x;y++)
{
printf("*");
}
printf("\n");
}
return 0;
}
Reply:#include %26lt;iostream.h%26gt;
#include %26lt;conio.h%26gt;
void main()
{
int i,j;
for (i=0;i%26lt;3;i++);
for (j=0;j%26lt;i;j++);
printf("*");
getch()
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment