Write a C program that includes a function called lobster th
Write a C program that includes a function called lobster() that accepts three arguments: a character and two integers. The character argument is the character to be printed by lobster(). The second argument is the number of times that the character will be printed on a row. The third argument is the number of rows to be printed. Call your function from within your program in order to demonstrate that it works (use \'z\', 3, 5 as parameters). Comment your code, make sure it looks professional, and use meaningful variable names.
Solution
include<stdio.h>
void lobster(char,int,int); //function prototype
int main()
{
int row,col; //declare rows and columns in integer
char ch;
printf(\"Enter the character to be printed :\"); //read character
scanf(\"%c\",&ch);
printf(\"Enter the number of rows :\"); //read rows
scanf(\"%d\",&row);
printf(\"Enter the number of columns :\"); //read columns
scanf(\"%d\",&col);
lobster(ch,row,col); //call lobster function
return 0;
}
void lobster(char cha,int ro,int co)
{
for(int i=0;i<co;i++) //number of columns
{
for(int j=0;j<ro;j++) //number of rows
{
printf(\"%c\\t\",cha);
}
printf(\"\ \"); // goto new line after completing each row
}
}
