Write a program in ‘C’ to print the following format pyramid : 10m Dec2006

By | June 25, 2014

Write a program in ‘C’ to print the following format pyramid : 10m Dec2006

                C

            C C C

        C C C C C

    C C C C C C C

C C C C C C C C C

 

#include <stdio.h>
void main()
{
int I,J,N=5,K=0;
clrscr();
for(I=1;I<=N;I++)
{
for(J=1;J<=N-I;J++)
{
printf(” “);
}
while(K!=2*I-1)
{
printf(“C “);
K++;
}
K=0;
printf(“\n”);
}
getch();
}

#include <stdio.h>
void main()
{
int I,J,N=5,K=0;
clrscr();
for(I=1;I<=N;I++)
{
for(J=1;J<=N-I;J++)
{
printf(" ");
}
while(K!=2*I-1)
{
printf("C ");
K++;
}
K=0;
printf("\n");
}
getch();
}

Screen Shots:

C_program_Pyramid_Format

C_program_Pyramid_Format_Output

 

Write a non-recursive procedure in ‘C’ for calculating power of a number ‘m’ raised by another number ‘n’ i.e. mn. 10m Dec2006

Solved program can be found on this link http://cssimplified.com/c-programming/write-the-functions-to-perform-the-following-10m-dec2005

Leave a Reply