Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: exercise #3125
    starfish
    Participant

    hi frd,

    just see if u can find this appropriate….

    #include 
    using namespace std;

    main(){

    int a[10];
    int n,i,j=0,k;

    cout<<"Enter the value for n: ";
    cin>>n;
    k=n;

    for (i=0 ;i < 10; i++)
    a=i + 1;

    while(k>0){
            for(i=(0+j);i                 cout<         for(i=n-2;i>=(0+j);i--)
                    cout<         cout<         j++;
            for(i=0;i                 cout<<" ";
            k--;
    }

    return 0;
    }

    Output :

    Enter the value for n: 5
    1 2 3 4 5 4 3 2 1
    2 3 4 5 4 3 2
        3 4 5 4 3
          4 5 4
            5

    plz let me know if you have any further queries

Viewing 1 post (of 1 total)