hi buddy
This commit is contained in:
1 parent
19881139f2
commit
7a1383f13c
23 files changed
+94
No files matched your search
@@ -0,0 +1,2 @@
|
||||
for i in range (11):
|
||||
print(i, end=" ")
|
||||
@@ -0,0 +1,3 @@
|
||||
num = int(input("Enter a number: "))
|
||||
|
||||
print(str(num)[::-1])
|
||||
@@ -0,0 +1,4 @@
|
||||
n = int(input("Enter a number: "))
|
||||
|
||||
b = sum(range(1, n+1))
|
||||
print(b)
|
||||
@@ -0,0 +1,5 @@
|
||||
a = int(input("Enter a number: "))
|
||||
c = 1
|
||||
while (c <= 10):
|
||||
print(a * c)
|
||||
c += 1
|
||||
@@ -0,0 +1,7 @@
|
||||
a = int(input("Enter a number: "))
|
||||
b = a * 5
|
||||
c = b % 2
|
||||
if (c != 0):
|
||||
print("Not divisible by 5")
|
||||
else:
|
||||
print("Divisible by 5")
|
||||
@@ -0,0 +1,7 @@
|
||||
a = int(input("Enter a number: "))
|
||||
count = 0
|
||||
|
||||
while (a > 0):
|
||||
count = count + 1
|
||||
a = a // 10
|
||||
print(count)
|
||||
@@ -0,0 +1,2 @@
|
||||
for i in range(-10,0):
|
||||
print(i, end=" ")
|
||||
@@ -0,0 +1,9 @@
|
||||
tg = int(input("Enter a number: "))
|
||||
|
||||
for number in range(1,tg+1):
|
||||
if number > 1:
|
||||
for i in range(2, number):
|
||||
if (number%i) == 0:
|
||||
break
|
||||
else:
|
||||
print(number)
|
||||
@@ -0,0 +1,11 @@
|
||||
a = 100
|
||||
|
||||
n1, n2 = 0, 1
|
||||
count = 0
|
||||
|
||||
while count < a:
|
||||
print(n1)
|
||||
nth = n1 + n2
|
||||
n1 = n2
|
||||
n2 = nth
|
||||
count += 1
|
||||
@@ -0,0 +1,5 @@
|
||||
import math
|
||||
|
||||
a = int(input("Enter a number: "))
|
||||
b = math.factorial(a)
|
||||
print(b)
|
||||
Reference in new issue
Block a user