C Pyramid Program

1
1 2 2
1 2 2 3 3
1 2 2 3 3 4 4
how to create this pyramid using c

Showing Answers 1 - 5 of 5 Answers

jayasri lakshmi

  • Jul 24th, 2011
 

Code
  1.  

  2.  

  3. #include<stdio.h>

  4. "%d""%d""

  5. ");

  6. }

  7. }

  Was this answer useful?  Yes

varun pujara

  • Jun 18th, 2014
 

1 12 123 1234

  Was this answer useful?  Yes

Andy

  • Nov 4th, 2017
 

Code
  1. #include <iostream>

  Was this answer useful?  Yes

Arun

  • Nov 9th, 2017
 

#include "stdio.h"
#include "conio.h"
void vd_g_printPyramid(int szOfPyramid)
{
int i;
int j;
for (i = 0; i < szOfPyramid; i++)
{
for (j = 0; j <= i; j++)
{
if (j == 0)
{
printf("%d", j+1);
}
else
{
printf("%d%d", j + 1, j + 1);
}
}
printf("
");
}
}
int main()
{
printf("
Hello World");
int i = 0;
printf("
Enter size of pyramid");
scanf_s("%d",&i);
vd_g_printPyramid(i);

_getch();
return 0;
}

Code
  1. #include "stdio.h"

  2. #include "conio.h"

  3. "%d""%d%d""

  4. ""

  5. Hello World""

  6. Enter size of pyramid");

  7.         scanf_s("%d"

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions