#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSString *str;
for (int i=1; i<10; i++) {
for (int j=1; j<=i; j++) {
if(j==1){
str=[NSString stringWithFormat:@"%d*%d=%2d",j,i,j*i];
}else
str=[NSString stringWithFormat:@"%@ %d*%d=%2d ",str,j,i,i*j];
}
NSLog(@"%@",str);
}
}
return 0;
}
|
|