C : Program for printing asterisk in right angle triangle shape
Oct 19, 2023
Program :
//c program for printing asterisk in right angle triangle shape
#include<stdio.h>
int main()
{
int rows;
printf("Enter the number of rows :");
scanf("%d", &rows);
for(int i=1; i<=rows; i++)
{
for(int j=1; j<=rows; j++)
{
if(j==1 || i==j || i==rows)
{
printf("* ");
}
else
{
printf(" ");
}
}
printf("\n");
}
return 0;
}
Output :