Reply
#include <cs50.h>
#include <stdio.h>
int main(void)
{
for (int j=0; j<5; j++)
{
for (int i=0; i<5; i++)
{
printf(“#”);
}
printf(“\n”);
}
}
Removing hardcoding to 5
Instead of predetermined 5 bricks, why not ask user to enter no. of bricks.
#include <cs50.h>
#include <stdio.h>
int main(void)
{
int t = get_int(“no. of bricks “);
for (int j=0; j<t; j++)
{
for (int i=0; i<t; i++)
{
printf(“#”);
}
printf(“\n”);
}
}
[learn_press_profile]