how to write a cprogram yo get output in the form
*
***
*****
*******
*********
*******
*****
***
*

Answer Posted / c.p.senthil

description for previous answer posted again

n = 5
loop 1: i = 0 to 4
loop 2: i = 5 to 0

Loop variables => i j k j exp k exp
.....*............0 5 spaces, 1 stars (5-0) (2*0)+1
....***...........1 4 spaces, 3 stars (5-1) (2*1)+1
...*****..........2 3 spaces, 5 stars (5-2) (2*2)+1
..*******.........3 2 spaces, 7 stars (5-3) (2*3)+1
.*********........4 1 spaces, 9 stars (5-4) (2*4)+1
***********.......5 0 spaces, 11 stars(5-5) (2*5)+1
.*********........4 1 spaces, 9 stars (5-4) (2*4)+1
..*******.........3 2 spaces, 7 stars (5-3) (2*3)+1
...*****..........2 3 spaces, 5 stars (5-2) (2*2)+1
....***...........1 1 spaces, 3 stars (5-1) (2*1)+1
.....*............0 5 spaces, 1 stars (5-0) (2*0)+1

..........generalising expressions => (n-i) (2*i)+1

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different types of errors?

646


Explain why c is faster than c++?

575


Why do we need functions in c?

561


What is main () in c language?

598


What are the disadvantages of external storage class?

592






What is a structure and why it is used?

621


What is structure packing in c?

608


What is calloc in c?

663


Is swift based on c?

640


What is return type in c?

639


In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)

1634


Can you please explain the difference between strcpy() and memcpy() function?

602


What does *p++ do? What does it point to?

616


What is #error and use of it?

681


In a header file whether functions are declared or defined?

630