Calculate 1995 US personal income tax

Source: Internet
Author: User

"C and Pointers" chapter 8th programming Exercises 2nd:

1 /*2 * * Calculation of income tax for U.S. citizens in 19953 */4 5#include <stdio.h>6#include <float.h>//The header file contains the largest number that the double type can represent Dbl_max7 8 DoubleSingle_tax (Doubleincome);9 Ten /* One * * Divide the range in the table into arrays A */ - Static Double ConstIncome_limit[] = {0,23350,56550,117950,256500, Dbl_max}; - Static Double ConstBase_tax[] = {0,3502.5,12798.5,31832.5,81710.5 }; the Static Double ConstPercentage[] = {0.15,0.28,0.31,0.36,0.396 }; -  - intMain () - { +     Doubleincome; -scanf"%LF", &income); +printf"%LF", Single_tax (income)); A      at     return 0; - } -  - /* - * * function, calculate the corresponding income corresponding to the tax amount - * * The data type of function prototype in the title is float, but float is not accurate in the test in */ - Double  toSingle_tax (Doubleincome) + { -     intrange; the     DoubleTax ; *      $     /*Panax Notoginseng * * Get the calculation interval corresponding to the tax amount -     */ the      for(range =1; Income > income_limit[Range]; ++range) +         ; ARange--; the      +     /* - * * Tax calculation formula $     */ $Tax = base_tax[Range] + (income-income_limit[Range]) *percentage[Range]; -      -     returnTax ; the}

Calculate 1995 US personal income tax

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.