### How to work out %20 in c++

Need help working out 20% of the interest. the program asks if to tax interest the user selects y or n, but need help on how to work out %20 of the interest then display how much tax was deducted in tax.

Relevant code imo.

case 'y':
tax = interestPaid /
break;
case 'n':
/// enter in here what you want it to do if user puts n
break;
default:
cout << "invalid input" << endl;
break;
}

All the code so far

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051`` ``````#include using namespace std; int main(){ int accBalance = 0; float interestPaid = 0; float interestRate = 0; float totalBalance = 0; char taxes; int tax cout << "Enter account balance : "; cin >> accBalance; cout << "Tax the interest(y/n)? "; cin >> taxes; if( accBalance <= 1000 || accBalance > 0 ){ interestRate = 0.02; interestPaid = interestRate * accBalance; totalBalance = accBalance + interestPaid ; } else if( accBalance > 1000 ){ interestRate = 0.05; interestPaid = interestRate * accBalance; totalBalance = accBalance + interestPaid ; } switch(taxes){ case 'y': tax = interestPaid / break; case 'n': /// enter in here what you want it to do if user puts n break; default: cout << "invalid input" << endl; break; } cout << "Total Balance : " << totalBalance << endl; cout << "Interest Rate : "; if( accBalance <= 1000 ) cout << "2%" << endl; if (accBalance > 1000) cout << "5%" << endl; cout <<"Interest Paid : " << interestPaid << endl; return 0; }``````
Topic archived. No new replies allowed.