Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTanuj Wadhi
869 PointsNew at coding; doubt about code..
Im using Xcode 5, language C. and my input was:
include <stdio.h>
int main()
{ int i =2; int result;
while (i>0) {
result=i*i;
printf("%20d ^ 2 = %20d\n", i, result);
i = i*i;
}
return 0;
}
thats my code.
and my result is:
2 ^ 2 = 4 4 ^ 2 = 16 16 ^ 2 = 256 256 ^ 2 = 65536 65536 ^ 2 = 0
Just wondering why the code couldn't square "65536".
2 Answers
Mohd Maqbool Alam
Full Stack JavaScript Techdegree Student 5,715 PointsCHANGE TO FLOAT OR MORE LARGER VALUE TYPE
Mohd Maqbool Alam
Full Stack JavaScript Techdegree Student 5,715 Pointsbecause of its type INTEGER