Index
Intro
Here we create a Basic Banking System in C Language which is mainly used for maintain the Bank Balance of an Account and updates it based on the users inputs.
Basic Banking System Operations
Deposit Formula
New Balance = Current Balance + Deposit Amount
The Program ensures that the deposit amount is positive before updating the balance.
Withdrawal Formula
New Balance = Current Balance - Withdrawal Amount
The Program ensures that the withdrawal amount is positive and does not exceed the current balance before updating the balance.
Codes
Here you get free Complete codes of the Project – Basic Banking System,
#include <stdio.h> // Function to display the current balance void displayBalance(float balance) { printf("Current Balance: $%.2f\n", balance); } // Function to deposit an amount into the account void deposit(float *balance) { float amount; printf("Enter the amount to deposit: $"); scanf("%f", &amount); if (amount > 0) { *balance += amount; printf("$%.2f deposited successfully.\n", amount); } else { printf("Invalid deposit amount.\n"); } } // Function to withdraw an amount from the account void withdraw(float *balance) { float amount; printf("Enter the amount to withdraw: $"); scanf("%f", &amount); if (amount > 0) { if (amount <= *balance) { *balance -= amount; printf("$%.2f withdrawn successfully.\n", amount); } else { printf("Insufficient balance.\n"); } } else { printf("Invalid withdrawal amount.\n"); } } int main() { float balance = 0.0; // Initial balance int choice; while (1) { printf("\nBanking System Menu:\n"); printf("1. Display Balance\n"); printf("2. Deposit\n"); printf("3. Withdraw\n"); printf("4. Exit\n"); printf("Enter your choice: "); scanf("%d", &choice); switch (choice) { case 1: displayBalance(balance); break; case 2: deposit(&balance); break; case 3: withdraw(&balance); break; case 4: printf("Exiting program.\n"); return 0; default: printf("Invalid choice. Please try again.\n"); } } }