Hi I'm new to programming I had to complete a task to print a diamond with numbers i did all the logic's but cant seem to figure out the spacing it dosen't make a diamond please help! Here's my code
#include<iostream>
using namespace std;
int main()
{
int num = 1;
for (int i = 0; i <= 5; i++)
{
for (int j = 1; j <= 9/2+1 - i; j++)
{
cout << " ";
}
for (int k = 1; k <= i; k++)
{
cout << num << " ";
num++;
}
cout << endl;
}
for (int i = 9; i > 5; i--)
{
for (int j = 9; j >=i; j--)
{
cout << " ";
}
for (int k = i; k > 5; k--)
{
cout << num<< " ";
num++;
}
cout << endl;
}