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
How do you sort filenames in a directory?
Why functions are used in c?
What is #line used for?
What are the different types of pointers used in c language?
What is || operator and how does it function in a program?
The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?
What is the difference between test design and test case design?
The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.
Why do we write return 0 in c?
Explain the binary height balanced tree?
What is the use of a conditional inclusion statement in C?
What is a nested formula?
Is that possible to add pointers to each other?
What is variable initialization and why is it important?
What are the advantages of union?