can u help me? I have problem in my program a little bit only! . . .
Code:
#include <iostream>
#include <math.h>
using namespace std;
main ()
{
float num;
cout<<"Enter #: ";
cin>>num;
float ans=num/10;
float a[10];
for(int i=0; i<=10; i++)
{
a[i]=ceil(ans*i);
}
for(int x=10; x>=0; x--)
{
cout<<a[x]<<endl;
}
system("pause");
}
if I enter 23 the output must be
23
21
19
17
15
13
11
9
7
5
3
but in my program its output is
23
21
19
17
14
12
10
7
5
3
0
can u help me to fix this i don't have an idea how to do it!
thanks advance!