반응형
for문은 C언어와 사용법이 같다.
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
int n, number, triangularNumber;
NSLog(@"Whata&number);
triangularNumber = 0;
for(n=1; n <= number; ++n)
triangularNumber += n;
NSLog(@"NUMBER %i is %i\n", number, triangularNumber);
}
return 0;
}
'프로그래밍 > Objective C' 카테고리의 다른 글
Objective C - @class 지시어 사용하기 (0) | 2015.09.15 |
---|---|
Objective C - 상속으로 확장하기 (새 메소드 추가) (0) | 2015.09.14 |
Objective C - 간단한 예제를 이용한 상속이해 (0) | 2015.09.11 |
Objective C - 세터(setter)와 게터(getter) 자동 생성 및 클래스를 인자로 넘기기 (0) | 2015.09.06 |
Objective C - 인터페이스와 구현파일 나누기 (0) | 2015.09.06 |
Xcode에서 Objective C class가 없을때 (0) | 2015.09.06 |
Objective C - 간단한 클래스를 활용한 계산기 만들기 (0) | 2015.08.31 |
ObjectiveC - 클래스 및 메소드 구현 방법 (interface, implementation) (1) | 2015.08.06 |