How to write a C Program Nested Loop (inverted Triangle) C Code in C Programming Language ?
Here is a C Code for Nested loop ( inverted Triangle) with Output.
Solution:
- #include<stdio.h>
- int main()
- {
- int i,j,k,l;
- for(i=1;i<=5;i++)
- {
- for(j=1;j<=i;j++)
- {
- printf(" ");
- }
- for(k=5;k>=i;k--)
- {
- printf("*");
- }
- for(l=i;l<=4;l++)
- {
- printf("*");
- }
- printf("\n");
- }
- }
- /* Output will be like
- *********
- *******
- *****
- ***
- *
- */
Learn More :
Inverted
Triangle
- Waveform Generation (Triangle Wave) C Program
- C Program To Show Pascal Triangle
- C Program to Print Floyd's Triangle
- Triangle Wave in C Program
- C Program to calculate the sum of elements of upper triangle of a n*n matrix using DMA
- Calculate sum of element of upper triangle of m*n matrix by using dynamic memory allocation
- Calculate sum of element of lower triangle of m*n matrix by using dynamic memory allocation
- Bitmap Triangle in C Program
- C Program to Rectangular Triangle Using Operator
Output
- DISPLAY SOURCE CODE AS OUTPUT IN C PROGRAM
- C Program to Save output of system command to variable with popen
- C Program Basic logging of user input/output
- C Program File Input & Output Example
- C Program To Print String In Formatted Output Form
- A small I/O bound program to copy N bytes from an input file to an output file.