Thread: Looking for a best formular

  1. #1
    C-Dumbie
    Guest

    Looking for a best formular

    Hi,
    I looking for a best way to code a program which split the a amount of money into dollars and cents.
    Code:
      
      int main()
      {
         float money;
         
         printf("Please enter the cost: ");
         scanf("%f", &money);
    
          /* need a good formular here to split money into dollars and cents */
    
        printf("The cost is %d  dollars and  %d cents", dollars, cents);
    
       return 0;
    }
    Input:   Please enter the cost:  4.69
    
    Output: The cost is  4  dollars and 69 cents
    Your help would be appreciated.

    C-Dumbie

  2. #2
    Registered User
    Join Date
    Sep 2002
    Posts
    137
    Do a board search, there are loads of examples of this kind of program.
    http://uk.geocities.com/ca_chorltonkids

  3. #3
    CS Author and Instructor
    Join Date
    Sep 2002
    Posts
    511
    Yes, It must be a popular program. Look at some post from the previous few days. The answers are there.

    Mr. C.

  4. #4
    Registered User
    Join Date
    Sep 2002
    Posts
    137
    I wonder if its the fact that the new school/college year has recently started that all of these similar questions are being asked.
    http://uk.geocities.com/ca_chorltonkids

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Resource ICONs
    By gbaker in forum Windows Programming
    Replies: 4
    Last Post: 12-15-2003, 07:18 AM