Click the Follow Button

do_while loop is to do something again and again

PROGRAM:

#include <stdio.h>

int main()
{
    int n;
    // do - while loop is to do something again and again
    do
    {
    printf("enter the number- \n");
    scanf("%d", &n);
    }
    while (n<1);

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            printf("*");
        }
        printf("\n");
    }
}

 OUTPUT:

enter the number-

5

*****

*****

*****

*****

*****

Comments

Popular Posts

TIC - TAC - TOE

Prime and not prime number