1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

type conversion example

Discussion in 'C' started by sumitdeorepatil, Sep 11, 2011.

  1. sumitdeorepatil

    sumitdeorepatil New Member

    Joined:
    Sep 11, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    type conversion example
     
  2. johnBMitchell

    johnBMitchell New Member

    Joined:
    Feb 17, 2011
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    CA, USA
    Home Page:
    Code:
    #include<stdio.h>
    double calc_charge(double houre, double charge);
    int main(){
      double h=4;
      double c=2;
    printf(".2f\n", calc_charge(h,c));
      return 0;
    }
    double calc_charge(double houre, double charge){
      double value;
      if(houre<=3.0)
      {
        return charge;
      }
      else 
      {
        value=(2+(0.5*(houre-3)));
        return value;
      }
    }
     

Share This Page