Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- int a, baris, kolom;
- printf("Masukkan ukuran kotak = ");
- scanf("%d", &a);
- for(baris = 1; baris <= a ; baris++){
- for(kolom = 1 ; kolom <= a ; kolom++){
- if( a % 2 == 0){
- if( (baris == 1 || kolom == 1) ||
- (baris == a || kolom == a) ||
- (baris == a/2 || kolom == a/2) ||
- (baris == (a/2)+1 || kolom == (a/2)+1) )
- printf("*");
- else printf(" ");
- }
- else if( (baris == 1 || kolom == 1) ||
- (baris == a || kolom == a) ||
- (baris == (a/2)+1 || kolom == (a/2)+1) )
- printf("*");
- else printf(" ");
- }printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement