Simple but complicate. Objective-C

+1 Savad Dekrup · May 8, 2015
Bruh... I need help with this.
#import 

int main(int argc, const char * argv[]) {
    @autoreleasepool {

        int aNumber = 3;
        int total;
        
        while(aNumber > 0){
            NSLog(@"%i",aNumber);
            total *= 5;
            aNumber -= 1;
        }
        
        NSLog(@"%i",total);
        
    }
    
    return 0;
}


I don't know why it is not working. It returns 0. ._.
Note: I have a background of PHP & JAVA

Post a Reply

Replies

Oldest  Newest  Rating
0 Awesome Deep · May 13, 2015
If your expected total value is 125 then set int total = 1;
  • 1

iOS Development / Swift

107,321 followers
About

This forum is for questions, comments, and general discussion about iOS Development and Swift.

Links
Moderators
Bucky Roberts Administrator