Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 335076f

Browse files
New Programs added
1 parent a6de0d8 commit 335076f

11 files changed

+101
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
a = int(input('Enter value of a: '))
2+
b = int(input('Enter value of b: '))
3+
4+
c = a
5+
a = b
6+
b = c
7+
8+
print('The value of a after swaping is', a, 'and the value of b after swaping is', b)

‎11. Program.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"""
2+
Write a program to accept total sales amount and find the profit amount @ 5%.
3+
4+
lets say total sales is 50k so we have to find profit which is 5% of the total sales.
5+
if a person sales 50k a day then it means 5 percent of profit is 50,000 * 5/100 = 25,00.
6+
so 25,00 is the profit he gains if he sales 50,000 a day.
7+
"""
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
no1 = int(input('Enter 1st number: '))
2+
no2 = int(input('Enter 2nd number: '))
3+
operation = input('Enter which operation would you like to perform? ')
4+
5+
if operation == '+':
6+
print(no1 + no2)
7+
elif operation == '-':
8+
print(no1 - no2)
9+
elif operation == 'x':
10+
print(no1 * no2)
11+
elif operation == '/':
12+
print(no1 / no2)
13+
else:
14+
print('You enter an invalid operator!')

‎7. Calculation program.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
"""Write a program to calculate:
2+
a. Area of rectangle. b. Perimeter of rectangle. c. Area of square.
3+
d. Perimeter of square. e. Area of circle. f. Circumference of Circle.
4+
"""
5+
6+
# a)
7+
# lengthOfRectange = int(input('Enter length of rectangle: '))
8+
# widthOfRectangle = int(input('Enter width of rectangle: '))
9+
# areaOfRectangle = lengthOfRectange * widthOfRectangle
10+
# print('Area of rectangle is:', areaOfRectangle)
11+
12+
# b)
13+
# lengthOfRectange = int(input('Enter length of rectangle: '))
14+
# widthOfRectangle = int(input('Enter width of rectangle: '))
15+
# perimeterOfRectangle = 2 * (lengthOfRectange + widthOfRectangle)
16+
# print('Perimeter of rectangle is:', perimeterOfRectangle)
17+
18+
# c)
19+
# In square all sides are equal.
20+
21+
# lengthOfside = int(input('Enter length of a side of a square: '))
22+
# areaOfsquare = lengthOfside ** 2
23+
# print('Area of square is:', areaOfsquare)
24+
25+
# d)
26+
# In square all sides are equal.
27+
28+
# lengthOfside = int(input('Enter length of a side of a square: '))
29+
# perimeterOfsquare = 4 * lengthOfside
30+
# print('Perimeter of a square is', perimeterOfsquare)
31+
32+
# e)
33+
# import math
34+
# radius = int(input('Enter radius of a circle: '))
35+
# areaOfCircle = math.pi * (radius ** 2)
36+
# print('Area of circle is:', areaOfCircle)
37+
38+
# f)
39+
# import math
40+
# radius = int(input('Enter radius of a circle: '))
41+
# circumferenceOfCircle = 2 * math.pi * radius
42+
# print('Circumference of a circle is:', circumferenceOfCircle)

‎8. Program.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""
2+
Question: Write a program to accept electricity unit consumption and calculate total price at the rate of
3+
5 rs unit. Give a discount of 10% on all over bill.
4+
"""
5+
6+
"""
7+
5 rupee per unit.
8+
if user enters 200 units then it means 200*5 = 1000(total price), it is the price that you have to
9+
pay means 1000 Rs of elctricity is used.
10+
"""
11+
12+
unit = int(input('Enter units: '))
13+
rupeePerUnit = 5
14+
totalPrice = unit * rupeePerUnit
15+
print('Total price is:', totalPrice)
16+
priceAfterdiscount = totalPrice * 0.90
17+
print('Price after 10% of discount is:', priceAfterdiscount)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /