We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#include <stdio.h> #include <string.h>
int accountNumber, password; char accountHolderName[] = "Zafarullah"; double currentBalance = 5000.00;
// function prototypes void deposit(); void withdraw(); void balanceInquiry(); void easyload(); void billPayments(); void easypaisaLoans(); void bankTransfers();
int main() { int open; int* openPtr = &open;
printf("\033[0;31mPress 786 to continue: "); scanf("%d", openPtr); if (*openPtr != 786) { printf("\033[0;31mInvalid input! Please try again.\n"); return 0; } printf("\033[0;32mWelcome to Easypaisa App!\033[0m\n"); printf("\033[0;33mPlease enter your account number: \033[0m"); scanf("%d", &accountNumber); if (accountNumber == 12345) { printf("\033[44mPlease enter password: \033[0m"); scanf("%d", &password); if (password == 54321) { printf("\nAccount Holder Name: %s\n", accountHolderName); printf("Current Balance: %0.2lf PKR\n", currentBalance); } else { printf("\033[0;31mInvalid password entered!\n"); return 0; } } else { printf("\n\033[0;31mInvalid account number entered! Please try again.\n"); return 0; } while (1) { int transactionType; int* transactionTypePtr = &transactionType; printf("\n\033[0;35mPlease select a Transaction Type:\n"); printf("1. Deposit\n2. Withdraw\n3. Balance Inquiry\n4. Easyload\n5. Bill Payments\n6. Easypaisa Loans\n7. Bank Transfers\n8. Exit\n"); scanf("%d", transactionTypePtr); switch (*transactionTypePtr) { case 1: deposit(); break; case 2: withdraw(); break; case 3: balanceInquiry(); break; case 4: easyload(); break; case 5: billPayments(); break; case 6: easypaisaLoans(); break; case 7: bankTransfers(); break; case 8: printf("Exiting program...\n"); return 0; default: printf("\033[0;31mInvalid transaction type selected!\n"); break; } } return 0;
}
void deposit() { int depositAmount; int* depositAmountPtr = &depositAmount;
printf("\nEnter deposit amount: "); scanf("%d", depositAmountPtr); if (*depositAmountPtr <= 0) { printf("\033[0;31mInvalid deposit amount entered!\n"); return; } currentBalance += *depositAmountPtr; printf("Deposit successful! Current Balance: %0.2lf PKR\n", currentBalance);
void withdraw() { int withdrawAmount; int* withdrawAmountPtr = &withdrawAmount;
printf("\nEnter withdraw amount: "); scanf("%d", withdrawAmountPtr); if (*withdrawAmountPtr <= 0) { printf("\033[0;31mInvalid withdraw amount entered!\n"); return;
if (*withdrawAmountPtr > currentBalance) { printf("\033[0;31mInsufficient balance!\n"); return; }
currentBalance -= *withdrawAmountPtr; printf("Withdrawal successful! Current Balance: %0.2lf PKR\n", currentBalance); }
void balanceInquiry() { printf("\nAccount Holder Name: %s\n", accountHolderName); printf("Current Balance: %0.2lf PKR\n", currentBalance); }
void easyload() { int phoneNum; int* phoneNumPtr = &phoneNum;
printf("\nEnter phone number: "); scanf("%d", phoneNumPtr); int loadAmount; int* loadAmountPtr = &loadAmount; printf("Enter load amount: "); scanf("%d", loadAmountPtr); if (*loadAmountPtr <= 0) { printf("\033[0;31mInvalid load amount entered!\n"); return; } if (*loadAmountPtr > currentBalance) { printf("\033[0;31mInsufficient balance!\n"); return; } currentBalance -= *loadAmountPtr; printf("Load successful! Current Balance: %0.2lf PKR\n", currentBalance);
void billPayments() { int billAmount; int* billAmountPtr = &billAmount;
printf("\nEnter bill amount: "); scanf("%d", billAmountPtr); if (*billAmountPtr <= 0) { printf("\033[0;31mInvalid bill amount entered!\n"); return; } char billType[20]; printf("Enter bill type: "); scanf("%s", billType); if (strcmp(billType, "Electricity") == 0) { // perform electricity bill payment } else if (strcmp(billType, "Gas") == 0) { // perform gas bill payment } else if (strcmp(billType, "Water") == 0) { // perform water bill payment } else { printf("\033[0;31mInvalid bill type entered!\n"); return; } if (*billAmountPtr > currentBalance) { printf("\033[0;31mInsufficient balance!\n"); return; } currentBalance -= *billAmountPtr; printf("Bill payment successful! Current Balance: %0.2lf PKR\n", currentBalance );
void easypaisaLoans() { int loanAmount; int* loanAmountPtr = &loanAmount;
printf("\nEnter loan amount: "); scanf("%d", loanAmountPtr); if (*loanAmountPtr <= 0) { printf("\033[0;31mInvalid loan amount entered!\n"); return; } int loanDuration; int* loanDurationPtr = &loanDuration; printf("Enter loan duration in months (3, 6, or 12): "); scanf("%d", loanDurationPtr); if (*loanDurationPtr != 3 && *loanDurationPtr != 6 && *loanDurationPtr != 12) { printf("\033[0;31mInvalid loan duration entered! Duration should be 3, 6, or 12 months.\n"); return; } double interestRate; if (*loanDurationPtr == 3) { interestRate = 0.05; } else if (*loanDurationPtr == 6) { interestRate = 0.07; } else { interestRate = 0.1; } double totalLoan = *loanAmountPtr + (*loanAmountPtr * interestRate); if (totalLoan > currentBalance) { printf("\033[0;31mInsufficient balance to process loan request!\n"); return; } currentBalance += totalLoan; printf("Loan approved! Your total loan amount is: %0.2lf PKR\n", totalLoan); printf("Current Balance: %0.2lf PKR\n", currentBalance);
void bankTransfers() { char bankName[50], bankAccount[50]; double transferAmount;
printf("\nEnter Bank Name: "); scanf("%s", bankName); printf("Enter Bank Account Number: "); scanf("%s", bankAccount); printf("Enter Transfer Amount: "); scanf("%lf", &transferAmount); if (transferAmount <= 0) { printf("\033[0;31mInvalid transfer amount entered!\n"); return; } if (transferAmount > currentBalance) { printf("\033[0;31mInsufficient balance!\n"); return; } currentBalance -= transferAmount; printf("\nTransfer Successful! Current Balance: %0.2lf PKR\n", currentBalance);
The text was updated successfully, but these errors were encountered:
No branches or pull requests
#include <stdio.h>
#include <string.h>
int accountNumber, password;
char accountHolderName[] = "Zafarullah";
double currentBalance = 5000.00;
// function prototypes
void deposit();
void withdraw();
void balanceInquiry();
void easyload();
void billPayments();
void easypaisaLoans();
void bankTransfers();
int main() {
int open;
int* openPtr = &open;
}
void deposit() {
int depositAmount;
int* depositAmountPtr = &depositAmount;
}
void withdraw() {
int withdrawAmount;
int* withdrawAmountPtr = &withdrawAmount;
}
if (*withdrawAmountPtr > currentBalance) {
printf("\033[0;31mInsufficient balance!\n");
return;
}
currentBalance -= *withdrawAmountPtr;
printf("Withdrawal successful! Current Balance: %0.2lf PKR\n", currentBalance);
}
void balanceInquiry() {
printf("\nAccount Holder Name: %s\n", accountHolderName);
printf("Current Balance: %0.2lf PKR\n", currentBalance);
}
void easyload() {
int phoneNum;
int* phoneNumPtr = &phoneNum;
}
void billPayments() {
int billAmount;
int* billAmountPtr = &billAmount;
}
void easypaisaLoans() {
int loanAmount;
int* loanAmountPtr = &loanAmount;
}
void bankTransfers() {
char bankName[50], bankAccount[50];
double transferAmount;
}
The text was updated successfully, but these errors were encountered: