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; } }
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;
}
+ 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.
+ 1
Gaurav Agrawal I gave the code please explain the correct code
+ 1
Gaurav Agrawal Thank you i understood