task
123454321
123454321
123454321
123454321
123454321





    #include<iostream>
    using namespace std;
    int main(){
    int i,j;
    for (i=1; i<=5; i++)
    cout<<i;
    for(j=4; j>=1; j--)
    cout<<j;
    }

But what the next ???

Recommended Answers

All 2 Replies

Your explanation of the task or homework is woefully incomplete. Try supply more along with what you feel is wrong with your solution.

#include <iostream>

using namespace std;

main

int num1 = 0;
int NumCount = 9;
int Rows = 5;

for (int j = 0; j < Rows; j++)
//{
    for (int i = 0; i < NumCount; i++, num1++)
   // {
        if (i < 5)
           cout << i + 1 ;
        else
            cout << NumCount - num1;
    //}

    num1 = 0;
    NumCount = 9;

    cout << endl;
//}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.