calculation

This is a discussion on calculation within the C Programming forums, part of the General Programming Boards category; hi guys! 1.) Could somebody tell me how to calculate below mentioned formula in terms of T R = 10K ...

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    17

    Lightbulb calculation

    hi guys!

    1.) Could somebody tell me how to calculate below mentioned formula in terms of T

    R = 10K Exp(3435( (1/(273+T) ) - 1/298)

    2.) I read A/D data from a port i get the data

    for example 1110111000 after A/D conversion

    Now i know that the above is equivalent to 939.6 in decimal.
    Pls tell me if i read the data and put in a variable will this variable have value" 939.6 "or first i need to conver it frm 1110111000 to 939.6 if so how should i do it?

    cool

  2. #2
    CS Author and Instructor
    Join Date
    Sep 2002
    Posts
    511
    Use math to solve the problem. I suggest to solve the program by hand the put it to the computer.
    Mr. C: Author and Instructor

  3. #3
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Here is a place to start.
    Code:
    #include <stdlib.h>
    #include <stdio.h>
    #include <math.h>
    
    double formula(double T)
    {
       return 10000.0 * exp(3435.0 * ( (1.0 / (273.0 + T)) - 1.0 / 298.0) );
    }
    
    int main(void)
    {
       const char data[] = "1110111000";
       double value = strtoul(data, NULL, 2);
       printf("formula(%f) = %f\n", value, formula(value));
       return 0;
    }
    
    /* my output
    formula(952.000000) = 1.628365
    */
    How 1110111000 becomes 939.6 I'm not sure. I think you need to provide more information for better advice.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Date calculation program
    By putty88 in forum C Programming
    Replies: 5
    Last Post: 04-17-2009, 07:24 AM
  2. Problem with modulo calculation
    By manutdfan in forum C Programming
    Replies: 6
    Last Post: 01-12-2009, 02:37 PM
  3. C# calculation problem
    By Diablo02 in forum C# Programming
    Replies: 13
    Last Post: 10-25-2007, 08:42 PM
  4. Help with calculation and loop
    By Betty in forum C Programming
    Replies: 7
    Last Post: 04-10-2006, 05:37 AM
  5. help with pay calculation program
    By shugstone in forum C++ Programming
    Replies: 2
    Last Post: 02-17-2003, 08:38 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21