Revision as of 18:43, 13 May 2024 by Admin (Created page with "Write a function that outputs a right isosceles triangle of height and width ''n'', so ''n = 3'' would look like <pre> * ** *** </pre>")
ABy Admin
May 13'24
Exercise
Write a function that outputs a right isosceles triangle of height and width n, so n = 3 would look like
* ** ***
ABy Admin
May 13'24
One possible solution:
#include<stdio.h>
int main(void) {
int n;
scanf("%d",&n);
for(int i=0;i<n;i++) {
for(int j=0;j<=i;j++)
putchar(42);
putchar(10);
}
while((n=getchar())!=10);
getchar();
return 0;
}