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
What language is windows 1.0 written?
Explain what is the difference between a string and an array?
Tell us something about keyword 'auto'.
Write a program to reverse a given number in c language?
Where are some collections of useful code fragments and examples?
What does nil mean in c?
Are pointers integer?
Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.
What does %d do in c?
When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.
What are run-time errors?
How can I dynamically allocate arrays?
How can you invoke another program from within a C program?
Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
What is the difference between array and pointer?