CODE :-
#include<stdio.h> int main() { int i, j, k, num; printf("\nEnter a number: "); scanf("%d",&num); printf("\n"); for(i = 0; i < num; i++) { for(k = 0; k < i+1; k++) { printf(" "); } for(j = 0; j < num; j++) { if(i == 0 || i == num - 1) { printf("*"); continue; } if(j == 0 || j == num - 1) printf("*"); else printf(" "); } printf("\n"); } return 0; }
No comments:
Write Comments