-
Notifications
You must be signed in to change notification settings - Fork 53
/
taxes.c
executable file
·39 lines (31 loc) · 893 Bytes
/
taxes.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* This program computes income taxes based on adjusted
* gross income and a child tax credit.
*
*/
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv) {
double agi = 0.0;
char c = 'N';
double tax = 0.0;
double childCredit = 0.0;
double totalTax = 0.0;
int numChildren = 0;
printf("Please enter your adjusted gross income (AGI): ");
scanf("%lf", &agi);
//remove the "enter" endline character
getchar();
printf("Do you have any children? (Y) or (N)? ");
c = getchar();
if(c == 'y' || c == 'Y') {
printf("How many children do you have? ");
scanf("%d", &numChildren);
}
//TODO: compute the tax, child credit, and total tax here
printf("AGI: $%10.2f\n", agi);
printf("Tax: $%10.2f\n", tax);
printf("Child Credit: $%10.2f\n", childCredit);
printf("Total Tax: $%10.2f\n", totalTax);
return 0;
}