Dtu Co Project
Dtu Co Project
CO-101
Project = ATM Machine code
Name: vivek kumar
Roll No: 24/A14/055
Batch: ECE- 4
ATM Machine code
=>introduction
n the modern world of technology and gadgets, ATMs have become a
fundamental part of present-day banking which usually focuses on performing
any financial transactions with ease and efficiency. The purpose of this project
is to write a Basic C Program as ATM simulator using simple methods to
support dynamic data operations at the standard output and reference single file.
Users will be able to —
- Authenticate them through their PIN
- Check their account balance
- Withdraw cash
- Deposit funds
- Exit the system
=>ALGORITHM
1. Start
2. Prompt user to enter PIN
3. Verify PIN
- If PIN is correct, proceed to step 4
- If PIN is incorrect, display error message and exit
4. Display main menu
- Options: Check Balance, Withdraw Money, Deposit Money, Exit
5. Get user's choice
6. Process transaction based on user's choice
- Case 1: Check Balance
- Display current balance
- Case 2: Withdraw Money
- Prompt user to enter withdrawal amount
- Check if withdrawal amount exceeds balance
- If sufficient balance, update balance and display success
message
- If insufficient balance, display error message
- Case 3: Deposit Money
- Prompt user to enter deposit amount
- Update balance and display success message
- Case 4: Exit
- Display exit message and terminate program
7. Go back to step 4 to display main menu again
8. End
=>COMPLETE CODE
#include <stdio.h>
int main() {
int pin, balance = 10000, withdraw, deposit;
int choice;
switch (choice) {
case 1:
printf("Your balance is: %d\n", balance);
break;
case 2:
printf("Enter amount to withdraw: ");
scanf("%d", &withdraw);
if (withdraw <= balance) {
balance -= withdraw;
printf("Withdraw successful. New balance is: %d\n",
balance);
} else {
printf("Insufficient balance\n");
} break;
case 3:
printf("Enter amount to deposit: ");
scanf("%d", &deposit);
balance += deposit;
printf("Deposit successful. New balance is: %d\n",
balance);
break;
case 4:
printf("Exiting...\n");
return 0;
default:
printf("Invalid choice\n");
}
}
} else {
printf("Invalid PIN\n");
}
return 0;
}
=>OUTPUT
=>LEARNING OBJECTIVES
1. Understand the basics of C programming: Learn the fundamental
concepts of C programming, including data types, variables,
operators, control structures, functions, and input/output operations.
3. Handle user input and output: Understand how to use scanf and
printf functions to read user input and display output.