Kindly give relevant answer
Answers
Answer:
*/
#include <stdio.h>
int main()
{
int i, j, rows;
/* Input rows from user */
printf("Enter number of rows: ");
scanf("%d", &rows);
/* Iterate through rows */
for(i=1; i<=rows; i++)
{
/* Print leading spaces */
for(j=1; j<i; j++)
{
printf(" ");
}
/* Iterate through columns to print star */
for(j=i; j<=rows; j++)
{
printf("*");
}
/* Move to next line */
printf("\n");
}
return 0;
}
Explanation:
Input
Input rows: 5
Output
*****
****
***
**
*
Mark it as brainliest
Q) Kindly give relevant answers.
Ans)
Code:-
#include <stdio.h>
int main()
{
int i, space, rows, k=0;
printf("Enter number of rows: ");
scanf("%d",&rows);
for(i=1; i<=rows; ++i, k=0)
{
for(space=1; space<=rows-i; ++space)
{
printf(" ");
}
while(k != 2*i-1)
{
printf("* ");
++k;
}
printf("\n");
}
return 0;
}