Disqus Shortname

Sunday, August 16, 2015

Program: Diamond



/*

*
***
*****
***
*

*/

#include <stdio.h>

int main() {

int n, c, k, space = 1;

printf("Enter number of rows\n");
scanf("%d", &n);

space = n - 1;

for (k = 1; k
for (c = 1; c printf(" ");

space--;

for (c = 1; c printf("*");

printf("\n");
}

space = 1;

for (k = 1; k
for (c = 1; c printf(" ");

space++;

for (c = 1; c printf("*");

printf("\n");
}

return 0;
}

/*-via Programming Hub for Android, a top rated Programming App on Google Play

https://play.google.com/store/apps/details?id=com.freeit.java*/


No comments:

Post a Comment