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;
}
|
|
Total comments: 0 | |