#include<iostream>
#include<math.h>
using namespace std;
int main()
{
int temp = 0, n = 1100, x = 0, t2 = 0, l = 10;
while(temp < n)
{
t2 = temp;
temp += pow(l, ++x);
cout << t2 << " " << temp << " " << x <<endl;
}
return(0);
}
The output obtained is :
0 10 1
10 109 2
109 1109 3
but I expect the output :
0 10 1
10 110 2
110 1100 3
Why this difference ?..please help ..I cant find out the problem
l. Looks awfully like1.<cmath>and clang 3.3 I get your expected output.