iOS Development

Course No. 10-152-139

Assignment 16-2


  • Create a new Xcode command-line project. Name the project Assignment-16-2.
    • The Type of the project must be Foundation.
  • Write a program that will have identical output to Assignment-16-1.
  • There is a method in the NSString class named stringByAppendingFormat:. Here is an excerpt from the documentation for the method.
  • Use this method in a for loop as in Assignment-16-1 to create the output string.
  • Start with the same variables.
  • And the same final output statement.
  • In between the variables and the ouput statement you can only have one for loop with some logic statements inside the loop.
  • You must use the stringByAppendingFormat: method to add the numbers to the outputString. You can’t just type the output string. It must be created in the loop one number at a time.
  • You must be able to change the loopMaximum variable and have the output adjust automatically. For example is the variable is set to 20 you would get this output, just like in Assignment-16-1.
  • NOTE: You can’t have a trailing comma. This is wrong output: