-
Notifications
You must be signed in to change notification settings - Fork 26
/
banking.c
43 lines (28 loc) · 879 Bytes
/
banking.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
40
41
42
43
/*
Write a program to read the data for the customer, calculate the interest and
service charge, and print the customer’s name, average balance, interest, and
service charge.
interest = 6% of average balance
service charge = 50 cents per transaction
*/
#include <stdio.h>
#include <string.h>
int main(){
char name[50], acctNum[20];
double aveBalance, interest, servCharge;
int transactions;
printf("Enter customer's name: ");
gets(name);
printf("Enter account number: ");
gets(acctNum);
printf("Enter the average balance: ");
scanf("%lf", &aveBalance);
printf("Enter the number of transactions: ");
scanf("%d", &transactions);
interest = 6.0/100 * aveBalance;
servCharge = 0.5 * transactions;
printf("Name: %s\n", name);
printf("Average balance: $%3.2f\n", aveBalance);
printf("Interest: $%3.2f\n", interest);
printf("Service Charge: $%3.2f\n", servCharge);
}