Circuit Negma

C++, C, VB.NET, PCB, Electronics, Circuit Design

Exercise Chapter 3. question 2

Posted by Circuit Negma on February 6, 2006

 * Exercise Chapter 3. question 2
 * by hussein, 2004
#include <stdio.h>

      // define variable.
      int cels;
      double fahr;
      //welcome screen
      printf("Temperature converter\n");
      //ask for temperature to be converted
      printf("Please enter temperature in Celsius: ");
      scanf("%d", &cels);
      //calculation and convertions
      fahr = 32 + (double)cels * 9 / 5 ; //casting is used to convert number from one format to another.
                                         //in this ex. cels is being converted from int to double.
      //print out the results
      printf("the equivalent temperature of %d in fahrenheit is %0.2f\n",cels,fahr);


One Response to “Exercise Chapter 3. question 2”

  1. Guest said

    Very interesting article

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: