Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3. Write a function that decides whether a number is a prime or not. A prime number is a number that is divisible only by
3. Write a function that decides whether a number is a prime or not. A prime number is a number that is divisible only by 1 and itself. The function prototype is int > is_prime (int n). The function returns true if n is prime and returns false otherwise. Write another function that displays all prime numbers less than or equal to a number. The function prototype is void display primes (int n). The function displays all prime numbers less than or equal to n. Note that the display primes function calls the helper function is prime. nimation that and tudent names and their scores from a user and displays the 3. Write a function that determines the tax amount according to the following tax rules. The tax rate depends on the income, the marital status, and the state residency. For in state residents, the following rates apply. If single and income is less than 30000 then tax rate is 20%. If single and income is greater or equal to 30000 then tax rate is 25%. If married and income is less than 50000 then tax rate is 10%. If married and income is greater or equal to 50000 then tax rate is 15%. For out of state residents, the similar rules apply except the tax rate is 3% less than the tax rate of the corresponding in state residents. The function prototype is double compute tax (int income, char *status, char state). The income is positive integer. The status is string single or married in lower or upper case letters. The state is character i oro in lower or upper case letters. The function computes and returns the tax amount. If any input is invalid then the function returns -1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started