+ 1
What is wrong in this programme? Since I want to print diamond of numbers.
i.e. input n =5 Output should be like this 1 123 12345 123 1 https://code.sololearn.com/cu5I0x6V5NSx/?ref=app https://code.sololearn.com/cu5I0x6V5NSx/?ref=app https://code.sololearn.com/cu5I0x6V5NSx/?ref=app
3 Answers
0
Give a space after number print. Like printf("%d ", a) ;
And 2nd else part replace this....
else if(j>=(n+1)/2)
{
for (k=0;k<n;k++)
{
if(k<=j-(n+1)/2)
printf (" ");
else if(k<(n+1)/2 && k-j<=(n+1)/2)
{
printf ("%d ",a);
a += 1;
}
If it not fit give a reply..
0
Jayakrishna still this code is not printing diamond of number after correction as u mentioned
0
It works with a space including as I mentioned... And it again ones check..
Programmer see this.
https://code.sololearn.com/ctBXaHT5wYRF/?ref=app