Question

Use nested for loop to display the following graphs: (choose one to work on)

Use 2 sets of for loop for this project.

(a) (b) (d)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

a)

Answer:

#include <stdio.h>
int main()
{
int i, j, rows=10;

for(i=1; i<=rows; ++i)
{
for(j=1; j<=i; ++j)
{
printf("* ");
}
printf("\n");
}
return 0;
}

Source coue #include <stdio.h> 2 int main() 4. int i, j, rows-10; for( 1-1; ++i) 1〈-rows; for(j-1; j<-i; ++j) printf(* 10

b)

Answer:

#include <stdio.h>
int main()
{
int i, j, rows=10;


for(i=rows; i>=1; --i)
{
for(j=1; j<=i; ++j)
{
printf("* ");
}
printf("\n");
}
  
return 0;
}

esc to close close fullscreen </> source code 1 #include<stdio.h> 2 int main() 4. int i, j, rows-10 for(i-rows; i>-1; --i) fo

3)

Answer:

#include <stdio.h>

int main()
{
int i, j, k;
for(i=10;i>=1;i--)
{
for(j=10;j>i;j--)
{
printf(" ");
}
for(k=1;k<=i;k++)
{
printf("*");
}
printf("\n");
}

return 0;
}

3 int main() 4. 5 6 int i, j, k; for(1-10;1〉-1;i--) 8 for(J-10;jij-) printf( ); for(k-1;k<-i;k++) printf(*); 10 12 13 14

4)

Answer:

#include <stdio.h>

int main()
{
int i, j, k;
for(i=10;i>=1;i--)
{
for(j=1;j<i;j++)
{
printf(" ");
}
for(k=10;k>=i;k--)
{
printf("*");
}
printf("\n");
}

return 0;
}

1 #include <stdio.h> 3 int main() int i, j, k; for (i-10i>-1;i--) 6 8 for(j-1;j<i;j++) 10 printf( ); for(k-10;k>-i;k-) 12 1

Add a comment
Know the answer?
Add Answer to:
Use nested for loop to display the following graphs: (choose one to work on) Use 2...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT