Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please anwser the following question in C programming and keep in mind this is a

ID: 3607665 • Letter: P

Question

Please anwser the following question in C programming and keep in mind this is a beginer programming course. I have also attached photos of examples of some inputs and outputs would be.

Write a program to display the following pattern on the screen. Your program must prompt the user for the number of lines to be printed and the desired width between the left and right figures. Note that the number of lines must be an even number. If the number of lines entered is an odd number, then your program must display a message 'Invalid input - number of lines must be even' and exit.

Sample Input: Number of lines? 10 Width between left and right figure? 3 Output:

Explanation / Answer

#include<stdio.h>

int main

{

int total Row=7;

int row, colspace, colstar;

for(row=1; row<2=totalRows; row++);

{

for(colspace= total Row-row; colspace>=1; colspace--)

{

for(colspace=1; colstar<=2*row-1; colstar++)

{

if(colspace<=6-1)

{

printf(" * ");

else

printf('' ");

}

printf(" ");

}

}

for(row=total Rows-1; row>=1; row--);

{

for(colspace=1; colspace<= totalRows-row; colspace++)

printf(" ")

}

for(colstar=1; colstar<=2*row-1; colstar++)

{

printf(" * ");

}

printf(" ");

}

}