Tuesday, July 29, 2014

C PROGRAM TO DISPLAY PYRAMID

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,l;
 clrscr();
for(k=1;k<=20;k++)
{
 printf(" ");
}
for(i=1;i<=5;i++) //outer loop  or rows
{
 for(j=1;j<=i;j++) //inner loop or columns
 {
   printf(" *");
 }
 printf("\n");
    for(l=1;l<=k-2;l++)
    printf(" ");
    k--;
}
getch();
}

Output
        *
    *    *
  *    *    *
 *   *   *   *
*   *  *  *  *

No comments:

Post a Comment

JAC Board Computer || IIT 2025 || Introductory Information Technology || Class 10 || Practical Examination 2025

Marks Division HOE 30 Marks IT Application Report File 20 Marks Viva - Voce 10 Marks 1) Write an HTML code to generate a web p...