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 trial

iOS

New 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

CHANGE TO FLOAT OR MORE LARGER VALUE TYPE

because of its type INTEGER