You are on page 1of 12

Our First Program!!!

#import <Foundation/Foundation.h>

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


{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSLog (@"Programming is fun!");
[pool drain];
return 0;
}
#import <Foundation/Foundation.h>

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

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

NSLog (@"Testing...\n..1\n...2\n....3");

[pool drain];

return 0;

}
#import <Foundation/Foundation.h>

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

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

int sum; sum = 50 + 25;

NSLog (@"The sum of 50 and 25 is %i", sum);

[pool drain];

return 0;

}
#import <Foundation/Foundation.h>

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

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

int value1, value2, sum;

value1 = 50;

value2 = 25;

sum = value1 + value2;

NSLog (@"The sum of %i and %i is %i", value1, value2, sum);

[pool drain];

return 0;

}
#import <Foundation/Foundation.h>

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

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

int answer, result;

answer = 100;

result = answer - 10;

NSLog (@"The result is %i\n", result + 5);

[pool drain];

return 0;

}
Write a program that subtracts the value 15 from 87
and displays the results with an appropriate message.

Tonight's Lab

You might also like