forked from SHabaj-dev/Hactoberfest-2022
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding ATM and ReportCard Program, Adding Pyhton Programs And adding …
…To-Do Web Application
- Loading branch information
1 parent
369ce08
commit 5b5f002
Showing
28 changed files
with
522 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
void showMenu() { | ||
cout<<"*********Menu************" << endl; | ||
cout<<"1. Check Balance" << endl; | ||
cout<<"2. Deposite" << endl; | ||
cout<<"3. Withdrawl" << endl; | ||
cout<<"4. Money Transfer" << endl; | ||
cout<<"5. Exit" << endl; | ||
cout<<"**************************"<< endl; | ||
} | ||
|
||
int main () | ||
{ | ||
//check balance, deposite, withdraw, show menu,transfer money | ||
int option; | ||
double balance = 50000; | ||
double pin = 2003; | ||
do{ | ||
showMenu(); | ||
cout<<"option:"; | ||
cin>>option; | ||
system("cls"); | ||
|
||
switch(option){ | ||
case 1: cout<<"Balance is: " << balance << "$"<< endl; break; | ||
case 2: cout<<"Enter your Pin-: " | ||
int pin; | ||
cin>>pin; | ||
cout<<"Deposite Amount:"; | ||
double depositeAmount; | ||
cin>> depositeAmount; | ||
balance+= depositeAmount; | ||
cout<<"Total Amount:"<< balance <<endl; | ||
break; | ||
case 3: cout<<"Widthdraw Amount:"; | ||
double withdrawAmount; | ||
cin>> withdrawAmount; | ||
if (withdrawAmount <= balance) | ||
balance-= withdrawAmount; | ||
else | ||
cout<< "Not Enough Money" << endl; | ||
cout<<"Total Amount:"<< balance <<endl; | ||
break; | ||
case 4: cout<<"Transfer Amount:"; | ||
double transferAmount; | ||
cin>> transferAmount; | ||
if (transferAmount <= balance) | ||
balance-= transferAmount; | ||
else | ||
cout<< "Not Enough Money" << endl; | ||
cout<< "Enter Account Number"; | ||
double accountnumber; | ||
cin>> accountnumber; | ||
cout<<"Transfer Successfully" << endl; | ||
cout<<"Total Amount:"<< balance <<endl; | ||
break; | ||
} | ||
cout<< "******Thankyou Soo Much, Have A Nice Day********"<< endl; | ||
|
||
} while(option!=5); | ||
|
||
system("pause>0"); | ||
|
||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include<iostream> | ||
using namespace std; | ||
|
||
int main() | ||
|
||
{ | ||
cout<<"Hello, Welcome Here"<<endl; | ||
cout<<"Please Enter Your Marks"<<endl; | ||
int maths,phy,chem,bio,english,music,fine,sum; | ||
float per; | ||
cout<<"Maths="; | ||
cin>>maths; | ||
|
||
cout<<"Physics="; | ||
cin>>phy; | ||
|
||
cout<<"Chemistry="; | ||
cin>>chem; | ||
|
||
cout<<"Biology="; | ||
cin>>bio; | ||
|
||
cout<<"English="; | ||
cin>>english; | ||
|
||
cout<<"Music="; | ||
cin>>music; | ||
|
||
cout<<"Fine Arts= "; | ||
cin>>fine; | ||
|
||
sum= maths+phy+chem+bio+english+music+fine; | ||
cout<<"\nTotal Marks="<<sum<< endl; | ||
if(sum >=201) | ||
cout<<"Congratulations, you have cleared the exam"; | ||
else | ||
cout<<"Sorry, Better Luck For Next Time"; | ||
per=sum*100/700; | ||
cout<<"\nYour Percentage-:/n%"<<per; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Python Programs | ||
### These Programs are very helpful in Learning Python Basic Concepts | ||
### This Will be Updated Regularly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
To add two matrices-: | ||
|
||
Ans-a = [[12,7,3], | ||
[4 ,5,6], | ||
[7 ,8,9]] | ||
b = [[5,8,1], | ||
[6,7,3], | ||
[4,5,9]] | ||
result = [[0,0,0], | ||
[0,0,0], | ||
[0,0,0]] | ||
|
||
for i in range(len(a)): | ||
for j in range(len(a[0])): | ||
result[i][j] = a[i][j] + b[i][j] | ||
for c in result: | ||
print(c) | ||
|
||
Output- | ||
[17, 15, 4] | ||
[10, 12, 9] | ||
[11, 13, 18] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Write a program to calculate area of rectangle-: | ||
|
||
Ans | ||
w = float(input('Please Enter the Width of a Rectangle: ')) | ||
h = float(input('Please Enter the Height of a Rectangle: ')) | ||
Area = w * h | ||
print("\n Area of a Rectangle is: %.2f" %Area) | ||
|
||
Output | ||
Please Enter the Width of a Rectangle: 20 | ||
Please Enter the Height of a Rectangle: 30 | ||
Area of a Rectangle is: 600.00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Write a program to read the temperature in Celsius from the user and convert it into Fahrenheit-: | ||
|
||
Ans | ||
celsius = 37 | ||
fahrenheit = (celsius * 1.8) + 32 | ||
print('%0.1f degree Celsius is equal to %0.1f degree Fahrenheit'%(celsius,fahrenheit)) | ||
|
||
Output-: | ||
37.0 degree Celsius is equal to 98.6 degree Fahrenheit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
To concatenate two lists-: | ||
|
||
Ans-list_1 = [1, 'a'] | ||
list_2 = [3, 4, 5] | ||
list_joined = list_1 + list_2 | ||
print(list_joined) | ||
|
||
Output- | ||
[1, 'a', 3, 4, 5] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
To sort a list of elements in descending order-: | ||
|
||
Ans-NumList = [10,20,80,50,100,60] | ||
print("\nElement Before Sorting is: ", NumList) | ||
NumList.sort(reverse=True) | ||
print("\nElement After Sorting List in Descending Order is:\n", NumList) | ||
OutputElement- | ||
|
||
Before Sorting is: [10, 20, 80, 50, 100, 60] | ||
Element After Sorting List in Descending Order is: | ||
[100, 80, 60, 50, 20, 10] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
distance.py | ||
|
||
distance = eval(input("enter Distance between cities in Km ")) | ||
|
||
print(distance*1000, " Metres") | ||
print(distance*100000, " Centi Metres") | ||
print(distance*0.6213, " Miles") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Write a program to test whether a number is divisible by 5 and 10 or by 5 or 10-: | ||
|
||
Ans | ||
number = int(input(" Please Enter any Positive Integer : ")) | ||
if(number % 5 == 0): | ||
print("Given Number {0} is Divisible by 5 ".format(number)) | ||
else: | ||
print("Given Number {0} is Not Divisible by 5 ".format(number)) | ||
|
||
Output | ||
a)Please Enter any Positive Integer : 55 | ||
Given Number 55 is Divisible by 5 | ||
b)Please Enter any Positive Integer : 59 | ||
Given Number 59 is Not Divisible by 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
To calculate the factorial of a number using recursion-: | ||
|
||
Ans-def recur_factorial(n): | ||
if n == 1: | ||
return n | ||
else: | ||
return n*recur_factorial(n-1) | ||
num = 10 | ||
if num < 0: | ||
print("Sorry, factorial does not exist for negative numbers") | ||
elif num == 0: | ||
print("The factorial of 0 is 1") | ||
else: | ||
print("The factorial of", num, "is", recur_factorial(num)) | ||
|
||
Output- 3628800 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Write a program to prompt a user to enter a day of the week. If the entered day of the week is between 1 and 7 then display the respective name of the day-: | ||
|
||
Ans | ||
weekday = int(input("Enter weekday day number (1-7) : ")) | ||
|
||
if weekday == 1 : | ||
print("\nMonday"); | ||
elif weekday == 2 : | ||
print("\nTuesday") | ||
elif(weekday == 3) : | ||
print("\nWednesday") | ||
elif(weekday == 4) : | ||
print("\nThursday") | ||
elif(weekday == 5) : | ||
print("\nFriday") | ||
elif(weekday == 6) : | ||
print("\nSaturday") | ||
elif (weekday == 7) : | ||
print("\nSunday") | ||
else : | ||
print("\nPlease enter weekday number between 1-7.") | ||
|
||
Output | ||
Enter weekday day number (1-7) : 5 | ||
|
||
Friday |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
To search a number from given list of numbers-: | ||
|
||
Ans- mylist = [1, 2, 3, 4, 5, 6, 7, 8] | ||
myinput = int(input("Type in a number ")) | ||
print("Number is in the list." if myinput in mylist else "Number not in | ||
list."). | ||
|
||
Output- | ||
Type in a number :5 | ||
Number is in the list. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Write a program to read three numbers from a user and check if the first number is greater or less than the other two numbers-: | ||
|
||
Ans | ||
num1 = float(input("Enter first number: ")) | ||
num2 = float(input("Enter second number: ")) | ||
num3 = float(input("Enter third number: ")) | ||
if (num1 >= num2) and (num1 >= num3): | ||
largest = num1 | ||
elif (num2 >= num1) and (num2 >= num3): | ||
largest = num2 | ||
else: | ||
largest = num3 | ||
print("The largest number is", largest) | ||
|
||
Output | ||
Enter first number: 10 | ||
Enter second number: 50 | ||
Enter third number: 30 | ||
|
||
The largest number is 50.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
palidrome.py(imp) | ||
|
||
givenString = (input("Enter a String ")) | ||
l = len(givenString) | ||
|
||
def checkPalindrome(givenString, l): | ||
newString = "" | ||
for i in range(l-1, -1, -1): | ||
newString += givenString[i] | ||
|
||
print(newString) | ||
if newString != givenString: | ||
print("Not Palindrome") | ||
else: | ||
print("Palindrome") | ||
|
||
checkPalindrome(givenString, l) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
list of prime.py | ||
|
||
prime = [] | ||
non_Prime = [] | ||
a = eval(input("Enter a ")) | ||
b = eval(input("Enter b ")) | ||
for i in range (a, b): | ||
for j in range(2, i): | ||
if i%j ==0: | ||
non_Prime.append(i) | ||
break | ||
else: | ||
prime.append(i) | ||
print("Prime Numbers between ", a, " and ", b, prime) | ||
print("Non-Prime Numbers between ",a, " and ", b, non_Prime) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
printnumbers.py | ||
|
||
count = 0 | ||
for i in range(1000,2000): | ||
if count % 10 == 0: | ||
print() | ||
print(i, end = " ") | ||
else: | ||
print(i, end = " ") | ||
count += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
quadatic roots | ||
|
||
import math | ||
|
||
a= float(input("Enter A ")) | ||
b= float(input("Enter B ")) | ||
c= float(input("Enter C ")) | ||
print(a) | ||
print(b) | ||
print(c) | ||
|
||
if a == 0: | ||
print("Error a=0 cannot be ") | ||
else: | ||
d = (b*b) - (4*a*c) | ||
if d >= 0: | ||
sqRoot = math.sqrt((b*b) - (4*a*c)) | ||
root1 = (-b + sqRoot)/2*a | ||
root2 = (-b - sqRoot)/2*a | ||
print("Roots : ",root1, root2) | ||
else: | ||
print("Imaginary Roots") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Write a program to return minimum of two numbers-: | ||
|
||
Ans | ||
def minimum(a, b): | ||
|
||
if a <= b: | ||
return a | ||
else: | ||
return b | ||
a = 2 | ||
b = 4 | ||
print(minimum(a, b)) | ||
Output- 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Write a program to calculate the square and cube of a number using *operator-: | ||
Ans | ||
def square (num): | ||
return num*num | ||
def cube (num): | ||
return num*num*num | ||
number = int(input("Enter an integer number: ")) | ||
print("Square of ",number," is ", square(number)) | ||
print("Cube of ",number," is ", cube(number)) | ||
|
||
OutputEnter an integer number: 5 | ||
Square of 5 is 25 | ||
Cube of 5 is 125 |
Oops, something went wrong.