Hello there
I am stuck on how to use nest while!! This is the question:
Write a program that reads in two integers m and n, and prints out an m-by-n rectangle of
asterisks.
(a) Use two nested while loops.
(b) Use two nested for loops.
I did the for loops okay but cannot figure out how the while works.
Code:
#include <stdio.h>
int main()
{
int m, n;
int i=0;
int j=0;
printf("Input value for m and n: \n"); //prompts
scanf("%d %d", &m, &n); //inputs
while(i <= m) // Size of m
{
i++;
printf("*");
}
while(j < n)
{
j++;
printf("*");
}
return 0;
}
What am i doing wrong?