Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8343921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:12:41+00:00 2026-06-09T06:12:41+00:00

Exercise: Write a program that converts 27° from degrees Fahrenheit (F) to degrees Celsius

  • 0

Exercise:
Write a program that converts 27° from degrees Fahrenheit (F) to degrees Celsius
(C) using the following formula:

C = (F – 32) / 1.8

Note that you don’t need to define a class to perform this calculation. Simply evaluating
the expression will suffice.

Here is my code:

#import <Foundation/Foundation.h>
int main (int argc, const char *argv[])
{
    NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init];

        float C;
        float F;
    F = 27;
    C=(F-32)/1.8;
    NSLog (@"27 degrees Fahrenheit is %f degrees Celsius." , C);
    [drain pool];
        return 0;
}

“Build failed”

On official forum there is a suggestion to write it this way :

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

   double C, F;
   F=27;
   C=(F-32)/1.8;
   int c=C;

    NSLog(@"%g degrees Fahrenheit equals %i centigrades!", F, c);

[pool drain];
    return 0;
}

But it also gives me “Failed” message.
What is not correct?

Update

Problem resolved.

I didn’t set up initial settings of my project properly.
I was working inside other “C” programming language project.
I had to just create new project-> OS X -> Command line tool (type: Foundation) unmark “Use Automatic Reference Counting”

But the best part- i was rewarded with successfully compiled program:

2012-08-09 00:20:29.214 4.2[19452:403] 27 degrees Fahrenheit is -2.777778 degrees Celsius.

Thank you @trojanfoe , @john.k.doe , @drewk , @hol

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T06:12:42+00:00Added an answer on June 9, 2026 at 6:12 am

    This works:

    #import <Foundation/Foundation.h>
    
    int main(int argc, const char * argv[])
    {
    
        @autoreleasepool {            
            float C;
            float F;
            F = 27.0;
            C=(F-32.0)/1.8;
            NSLog (@"27 degrees Fahrenheit is %f degrees Celsius." , C);
        }
        return 0;
    }
    

    So does this:

    #import <Foundation/Foundation.h>
    
    int main (int argc, const char * argv[]) {
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    
        double F=27.2;
        double C=(F-32.0)/1.8;
    
        NSLog(@"%g degrees Fahrenheit equals %g centigrade!", F, C);
    
        [pool drain];
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i need a quick hint regarding the following exercise question: Write a program that
I'm trying to complete an exercise to write a program that takes the following
Exercise 7-1. Write a program that converts upper case to lower or lower case
I direct you to Kernighan & Ritchie exercise 7.1 Write a program that converts
I don't fully understand what the following exercise is asking: Write a program detab
I'm doing a book exercise that says to write a program that generates psuedorandom
I'm working on an exercise from Accelerated C++: Write a program to count how
From C Primer Plus 5th Ed: Write a program that creates two eight-element arrays
I got this exercise at uni: Write a program that declares a shared integer
Write a program that randomly selects from a bag of eight objects. Each object

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.