About C/C++ Hub

C/C++ Learners Hub

Super friendly <br/>code & developer communities

Super friendly
code & developer communities

A place for coders and developers to share, learn and grow together.

Back to Hub

Kindly do me favour with this:  the criteria to qualify to get a loan form Zed bank is described as follows. First  the applicant must have an account with the bank. If the applicant  does not have an account with the bank, they are given the message, "please  open an account before applying". If the applicant has an account, the period of time the applicant has been with the bank is checked. If the period is less than 2 years , the applicant is given the message, "you have not banked with us for more than two years". If the period is 2 or more years, the credit record is then Checked. If the credit is "bad", the applicant is given a message, "your credit  history is bad". If the credit is "good", the applicant is asked for the amount they would like to borrow.  If amount entered is above $250,000, the applicant  is given a message.  "The maximum credit allowed is $250,000". If the amount is between $500 to $250,000,  the applicant is given the message, "congratulations you qualify to get a loan".  if the amount is below $500, the applicant is given the message, "the amount i below the minimum limit". Write a program  that  uses nested if statement to determine whether a person qualifies for a loan or not. 

1      Reply

Take a look at the program below:

GIVEN that there was no sufficient information in the question.
i.e. question was not clear. Where to take the data about accounts and credit score?
I assume that the information is entered by user.

using namespace std;

int main() {

  int years,cs;
  long acc,amount;

  cout<<"Enter your account number:";
  cout<<"Enter your period of time you were banking with us in years:";
  cout<<"Enter your credit score:";
  cout<<"Enter your amount you want to credit:";

  if (acc == 1001) {
    if (years > 2){
      if (cs > 5) {
        cout<<"Your Credit Score is Good"<<endl;
        if (amount < 250000) {
          if (amount>500){
            cout<<"Congratulations you qualify to get a loan"<<endl;
          } else {
            cout<<"The amount is below the minimum limit"<<endl;
        } else {
          cout<<"The maximum credit allowed is $250,000"<<endl;
      } else {
        cout<<"Your Credit Score is Bad"<<endl;
    } else {
      cout<<"You have not banked with us for more than two years"<<endl;
  } else {
    cout<<"Please open an account before applying";

  return 0;

Enter your account number:1001
Enter your period of time you were banking with us in years:5
Enter your credit score:6
Enter your amount you want to credit:1000
Your Credit Score is Good
Congratulations you qualify to get a loan