0

Print the given output using nested for loop without ```

```* * * * * * I tried this code #include <stdio.h> int main() { int i; char j='*'; { for(i=1;i<=3;i++) { for(j=i;j>=1;j--) printf("\t%c",'*'); printf("\t\n"); } return 0; } }

16th Oct 2019, 7:08 PM
Alfred Monir
Alfred Monir - avatar
4 Respuestas
+ 4
Alfred Monir Hugo You can try making another inner loop for handling spaces before star in each row, below is some modification in your code for it. #include <stdio.h> int main(){ int i; char j='*'; for(i=1;i<=3;i++){ for(int a=1;a<=3-i;a++) printf(" "); for(j=i;j>=1;j--) printf("%c ",'*'); printf("\t\n"); } return 0; }
16th Oct 2019, 8:22 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 4
Hy Alfred Monir Hugo Please provide your attempt for this problem, to get better help from community. Paste code link or your code to this problem.
16th Oct 2019, 8:07 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 1
Gaurav Agrawal I gave the code please explain the correct code
16th Oct 2019, 8:16 PM
Alfred Monir
Alfred Monir - avatar
+ 1
Gaurav Agrawal Thank you i understood
16th Oct 2019, 8:30 PM
Alfred Monir
Alfred Monir - avatar