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
Write a code to generate a series where the next element is the sum of last k terms.
What is the use of getchar() function?
How can I rethow can I return a sequence of random numbers which dont repeat at all?
Can you please explain the difference between malloc() and calloc() function?
What does *p++ do? What does it point to?
What is typedef?
What is sizeof int?
What is the difference between exit() and _exit() function in c?
Explain a pre-processor and its advantages.
a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);
What is static memory allocation? Explain
What is context in c?
What are identifiers in c?
what is the role you expect in software industry?
Give the rules for variable declaration?