/*
* 1000+ C programs + tutorials
*
*
* 60_c_program_to_display_asterisk_star_diamond_shape_sequence_9.c
*
*
*
* Created on: Oct 22, 2014
* Author: Code2care.org
*/
#include
//#include
void main() {
//clrscr();
int rows = 7;
int space = 6;
int i,j,k;
// Display Pyramid 1
for (i = 1; i <= rows; i++)
{
for (j = 1; j <= space; j++)
printf(" ");
space--;
for (k = 1; k <= 2*i-1; k++)
printf("*");
printf("\n");
}
// Display Inverted Pyramid 2
space = 1;
for (i = 1; i <= rows - 1; i++)
{
for (j = 1; j <= space; j++)
printf(" ");
space++;
for (k = 1 ; k <= 2*(rows-i)-1; k++)
printf("*");
printf("\n");
}
// getch();
}
The best way to learn C programming is to practice more and more of programs .
Code2care C Programming tutorials provide 1000+ programs in C that you can study and become an expert in the language. Programs are divided into categories depending upon type and complexity.
BSc. IT, BSc. Computer Science, BSc. IT, MSc. IT, MSc. Computer Science, MCA, BTech IT & BTech Engineers may find these programs very useful.