CodeSolved

A comprehensive source of programming questions and exercises

First numbers

Practice Easy 17/ Download 2555 Views

Write a program that receives numeric as A from the input andAll the first numbers smaller than aPrint in the output

16 Answers

This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
aval=True
num=int(input("please enter number: "))
num-=1
while num>1:
    div=num-1
    aval=True
    while div>1:
        if num%div==0:
            aval=False
            break
        div-=1
    if aval:
        print(num)
    num-=1
Saeeda33 Download Python
def prime(n):
    my_set = set()
    li = []
    for i in range(2, n):
        if i in my_set:
            continue
        for j in range(i*2, n, i):
            my_set.add(j)
        li.append(i)   
    return li
num = int(input("enter num: "))
print(prime(num))
a = int(input("add: "))
x = 2 
if a < 2:
    print ("avval nist")
elif a == 2:
    print ("avval ast")
else:
    while (x < (a//2)):
        if (a % x) == 0 :
            print("avval nist")
            break
        x = x + 1
    else:
        print("avval ast" )
User 3026 Download Python
a = int(input("add: "))
j = 2 
if a < 2:
    print ("avval nadarim")
elif a == 2:
    print (a)
else:
    while (j <= a):
        x = 2
        while (x <= (j//2)):
            if (j % x) == 0 :
                j = j + 1
                break
            x = x + 1    
        else:
            print(j)
            j = j + 1
User 3026 Download Python
# Prime Number
Num = int(input("give me a number : "))
PrimeList = [1,2,3]
for i in range(4,Num) :
    Count = 0
    for j in range(2,i):
        Rem = int(i % j)
        if Rem != 0:
            Count += 1
        else:
            break
    if Count == (i-2) :
        PrimeList.append(i)
print(f"The prime number of smaller than {Num} are : {PrimeList}")
User 463 Download Python
a = int(input("ye adad vared kon : "))
for i in range(2,a):
    for j in range(2,i):
        if i % j == 0:
            print(f"{i}❎ adade aval nist chon bar {j} bakhsh pazir ast")
            break
    else:
        print(f"{i}✅ adade aval ast")
Azhgun Download Python
adad= int(input("adad:"))
for j in range(2,adad):
    for i in range(2,j):
        if j%i==0:
            break
    else:
        print(j)
User 61 Download Python
<< Previous page 1 2 Next page >>

Submit answer

Submitting answers is currently unavailable.

Related content

Detection using AI
×
×
Close