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 is difference between function overloading and operator overloading?
What is a built-in function in C?
What is extern storage class in c?
In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping
What are the preprocessor categories?
What is the significance of scope resolution operator?
FILE PROGRAMMING
Differentiate between a structure and a union.
Explain how can a program be made to print the name of a source file where an error occurs?
Are there constructors in c?
Is c a great language, or what?
What does %d do in c?
Explain what is the concatenation operator?
Difference between macros and inline functions? Can a function be forced as inline?
Is c compiled or interpreted?