-(void)triAngle
{
NSMutableString *strTriangle = [[NSMutableString alloc]init];
for (int i = 0; i<3; i++)
{
for (int j = 0; j<=i; j++)
{
if(j==0 && i==0)
{
[strTriangle setString:@"\n*"];
}
else
[strTriangle appendString: @"*"];
}
[strTriangle appendString: @"\n"];
}
NSLog(@"%@",strTriangle);
}
OutPut :
**
***
No comments:
Post a Comment