0
C program for the following pattern
**** **** *** *** ** ** * * * * ** ** *** *** **** ****
7 Respuestas
+ 7
Your conditions are not working properly first do dry run then make logics
+ 6
Can you show your attempt we can't code on your behalf
https://www.sololearn.com/discuss/333866/?ref=app
https://www.sololearn.com/discuss/1316935/?ref=app
+ 3
Your code was pretty close
#include <stdio.h>
int main() {
int k=0;
for(int i=1;i<=9;i++)
{
(i<6)?k++:k--;
for(int j=1;j<=9;j++)
{
if((j<=5-k||j>=5+k) && i!=5)
printf("*");
else
printf(" ");
}
printf("\n");
}
return 0;
}
+ 1
#include <stdio.h>
int main() {
int k=0;
for(int i=1;i<=7;i++)
{
(i<=3&&(!(i==4)))?k++:k--;
for(int j=1;j<=7;j++)
{
if(((j<=4-k||j>=4+k))&&(i!=4))
printf("*");
else
printf(" ");
}
printf("\n");
}
return 0;
}
+ 1
There is no stars in full Row 5 and full column 5
0
Thnx
- 1
Hi