Draw a square Write a function square that takes two inputs

Draw a square. Write a function (square) that takes two inputs (a string, and an integer) and draws a square with the specified integer side length using the specified string.

Solution

ANS:

#include <stdio.h>
void square(char a[],int n);
int main()
{
char a[10];
int n;
printf(\"Enter a string\");
scanf(\"%s\",a);
printf(\"enter n(integer)\");
scanf(\"%d\",&n);
square(a,n);

return 0;
}
void square(char a[],int n)
{
int i,j;
for(i=1;i<=n;i++,printf(\"\ \"))
{
for(j=1;j<=n;j++)
{
printf(\"%s\",a);
}
  
}
}

 Draw a square. Write a function (square) that takes two inputs (a string, and an integer) and draws a square with the specified integer side length using the s

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site