• Source
    1. #import <objc/objc.h>
    2. #import <objc/Object.h>
    3. #import <Foundation/Foundation.h>
    4.  
    5. @interface TestObj : Object
    6. {
    7. //none
    8. }
    9. - (void)testMethod;
    10. @end
    11.  
    12. @implementation TestObj
    13. - (void)testMethod {
    14. //declare two NSInteger variables
    15. NSInteger var1,var2;
    16.  
    17. //scanf("%d,%d",var1,var2);
    18.  
    19. //assume that user enters 1 and 2
    20. var1=1; var2=2;
    21.  
    22. //printing a formatted output of the result of adding integer values
    23. printf("%d", (var1 + var2));
    24. }
    25.  
    26. int main()
    27. {
    28. id obj = [[TestObj alloc] init];
    29. [obj testMethod];
    30. return 0;
    31. }
    32. @end