Number Pattern

Anyone know how to make a program for this "1 5 2 4 3 3 4 2 5 1" pattern? I find it difficult. Please explain it to me
1
2
3
4
5
6
#include <iostream>

int main()
{
    std::cout << "1 5 2 4 3 3 4 2 5 1";
}
1
2
3
4
5
#include <iostream>
int main()
{
   for ( int i = 1; i < 6; i++ ) std::cout << i << " " << 6 - i << " ";
}
Thank you so muuuuuch! Now I know
Topic archived. No new replies allowed.