hollow sqr c

 #include <stdio.h>


int main() {

    // Write C code here

    int r , c;

    printf("No of rows : ");

    scanf("%d", &r);

    printf("No of columns : ");

    scanf("%d", &c);

    int i , j ;

    for (i=1;i<=r;i++){

        for (j=1;j<=c;j++){

            if (i==1 || i==r){

                printf("*");

            }

            else if(j==1 || j==c){

                printf("*");

            }

            else {

                printf(" ");

            }

        }

        printf("\n");

    }

    return 0;

    

}

Comments

Popular posts from this blog

Sum of Even Numbers till N

Find the Runner-Up Score!

Print All Substrings