[My site ]
Main » 2013 » December » 12 » C Programming Sheet - 8
11:31 PM
C Programming Sheet - 8
#include"stdio.h"
int main(void){
int n, i, j;
printf("enter n : ");
scanf("%d", &n);
for(i=1;i<=n;i++){
for(j=1;j<=i;j++){
printf("*");
}
printf("\n");
}
printf("\n\n");
for(i=1;i<=n;i++){
for(j=1;j<=n-i;j++){
printf(" ");
}
for(j=1;j<=2*i-1;j++){
printf("*");
}
printf("\n");
}
for(i=1;i<=2;i++){
for(j=1;j<(2*n+1)/2;j++){
printf(" ");
}
printf("*");
printf("\n");
}
getch();
return 0;
}



Category: C Programming - 1 | Views: 349 | Added by: ahansaary | Rating: 0.0/0
Total comments: 0
Only registered users can add comments.
[ Sign Up | Login ]