Write a function print that prints saw patterns with a width

Write a function print that prints saw patterns with a width, height and number of saws. Sample Output: (for width = 5. height = 3. number of saws = 4) **** Sample Output: (for width = 7. height = 2. number of saws = 3)

Solution

ANS:

Q4).

#include<iostream.h>

void print1(int width1,int height1);
main()
{
int width1=5,height1=3;

print1(width1,height1);

}

void print1(int width1,int height1)
{
int i,j,k;

for(k=0;k<=3;k++)
{

for(i=0;i<height1;i++)
{
if(i!=1)
{
for(j=0;j<width1;j++)
{
cout<<\"*\";
}

cout<<\"\ \";
}
else
{
cout<<\"*\ \";
}
}
cout<<\"\ \";
}
}

Q3).

#include<iostream.h>
using namespace std;
void print1(int width1,int height1);
main()
{
int width1=7,height1=2;

print1(width1,height1);

}

void print1(int width1,int height1)
{
int i,j,k;
for(k=0;k<3;k++)
{
for(i=0;i<height1;i++)
{
for(j=0;j<width1;j++)
{
cout<<\"*\";
}
cout<<\"\ \";
}
cout<<\"\ \";
}
}

 Write a function print that prints saw patterns with a width, height and number of saws. Sample Output: (for width = 5. height = 3. number of saws = 4) **** Sa
 Write a function print that prints saw patterns with a width, height and number of saws. Sample Output: (for width = 5. height = 3. number of saws = 4) **** Sa

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site