hello guys,

i want to write a program to cout the numbers i input (a-z) to (z-a)
like

input (1,2,3,4,5,6,7,8,9,10)
output(10,9,8,7,6,5,4,3,2,1)

and i tried this but it's out put the same sorting

``````    #include <iostream.h>

void main(void)
{
int Number[11],i,j;

cout<<"Enter The Numbers"<<endl;

for (i = 1; i<=10; i++)
{
cout<<"Number"<<i<<": ";
cin>>Number[i];

}
for (j=1;j<=10;j++)
{
cout<<Number[j]<<endl;

}

}
``````

That's because you're typing them in the order:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10

And you're outputting them in the same order.
Take a closer look at how you have your second loop setup.

That's because you're typing them in the order:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10

And you're outputting them in the same order.
Take a closer look at how you have your second loop setup.

yes i don't know how to make it, so please guide me :)

omg i've fixed it

``````    void main(void)
{
int Number[11],i,j;

cout<<"Enter The Numbers"<<endl;

for (i = 1; i<=10; i++)
{
cout<<"Number"<<i<<": ";
cin>>Number[i];

}
for (j=10;j>=1;j--)
{
cout<<Number[j]<<endl;

}

}
``````

^^

It is `int main()` not `void main(void)` and `#include <iostream>` not `...<iostream.h>`

it is int main() not void main(void) and #include <iostream> not

void) and #include <iostream> not

It is int main() not void main(void) and #include <iostream> not ...<iostream.h>

what's the diference ?

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.