HELP PLEASE! - Chapter 5 Challenge

I admit that I wasn’t able to figure this one out… I had to look at this forum for the answer on how to get this function to execute. Now that I see how this was handled, it makes perfect sense.

The only problem is that I am trying to run my program and it keeps crashing and won’t print the desired answer. Please see below.

// main.m
// Triangle
// Created by iMac on 1/19/15.
// Copyright © 2015 Big Nerd Ranch. All rights reserved.

#import <Foundation/Foundation.h>

static int totalValue = 180.0;

int main(int argc, const char * argv[])
float angleA = 30.0;
float angleB = 60.0;
float angleC = totalValue - (angleA + angleB);
printf(“The third angle of the triangle is %.0f.\n”, angleC);

return 0;


What am I doing wrong?

It looks like you selected the wrong type of OS X application and/or the wrong language.

#include is what is used in the C programming language. Objective C uses the #import.

Hope this helps.

Also you are not following the way to create the code with a function

the part that you entered float angleC = totalValue - (angleA + angleB); should be a function where you return the third

#include <stdio.h>

float angle (float angle1, float angle2)
float totalvalue = 180;

float angle3 = totalvalue - angle1 - angle2;
return angle3;


int main(int argc, const char * argv[]) {

float anglea = 30.0;
float angleb= 60.0;
float anglec = angle(anglea, angleb);
printf("the third angle is %.2f\n", anglec);

return 0;