0% found this document useful (0 votes)
22 views8 pages

Dtu Co Project

Dtu file

Uploaded by

ahersuraj23march
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views8 pages

Dtu Co Project

Dtu file

Uploaded by

ahersuraj23march
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Delhi Technological University

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;

printf("Enter your PIN: ");


scanf("%d", &pin);
if (pin == 1234) {
printf("Welcome to ATM Machine\n");
while (1) {
printf("1. Check Balance\n");
printf("2. Withdraw Money\n");
printf("3. Deposit Money\n");
printf("4. Exit\n");
printf("Enter your choice: ");
scanf("%d", &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.

2. Implement conditional statements and loops: Understand how to


use if-else statements, switch statements, for loops, and while loops to
control the flow of a program.

3. Handle user input and output: Understand how to use scanf and
printf functions to read user input and display output.

4. Simulate real-world scenarios: Apply programming concepts to


simulate a real-world ATM machine, including PIN verification,
balance checking, withdrawal, and deposit.

5. Develop problem-solving skills: Practice breaking down complex


problems into smaller, manageable parts, and develop logical thinking
to solve them.

6. Improve coding style and readability: Learn to write clean,


readable, and well-documented code, following best practices and
conventions.

7. Apply security principles: Learn basic security principles, such as


PIN verification and data protection, to ensure secure programming
practices.

You might also like