CodeSolved

A comprehensive source of programming questions and exercises

Find the coefficient of numbers

Practice Easy 167/ Download 963 Views

Write a program thatA one -digit numberGet from the input and find the coefficients smaller than 100 of those numbers and print in the output

11 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.
lis = []
def numbers() :  
    num1 = int(input("Enter your number : "))
    if num1 >= 0 and num1 <= 9 :
        for x in range(1, 101) :
            if num1 % x == 0 :
                lis.append(x)
        return lis
    else :
        print("lotfan adade tak reghami entekhab konid.")
        numbers()
numbers()
print(lis)
Emrimo Download Python
lis = []
def numbers() :  
    num1 = int(input("Enter your number : "))
    if num1 >= 0 and num1 <= 9 :
        for x in range(1, 101) :
            if num1 % x == 0 :
                lis.append(x)
        return lis
    else :
        print("lotfan adade tak reghami entekhab konid.")
        numbers()
numbers()
print(lis)
Emrimo Download Python
a= int(input("number:"))
If 0<a<10 :
    For i in range(1, 100+1):
        X=i*a
        If x>100:
            Break
        Else:
            Print(x)
Else:
    Print(" فقط اعداد تک‌رقمی ")
def find_multiples(number):
    multiples = []
    for i in range(1, 100 // number + 1):
        multiples.append(number * i)
    return multiples

# Get a one -digit number from the user
user_input = input("لطفاً یک عدد یک رقمی وارد کنید: ")

# Converting input to integers
try:
    number = int(user_input)
    if 0 <= number < 10:  # Check that the number is one digit
        # Find the melods
        multiples = find_multiples(number)
        
        # Display the result
        print(f"مضرب‌های {number} که کمتر از 100 هستند: {multiples}")
    else:
        print("لطفاً یک عدد یک رقمی (بین 0 تا 9) وارد کنید.")
except ValueError:
    print("لطفاً یک عدد صحیح وارد کنید.")
def find_factors(number):
    factors = []
    for i in range(1, 100):  # Search for numbers smaller than 100
        if number % i == 0:  # If I is the Number coefficient
            factors.append(i)
    return factors

if __name__ == "__main__":
    # Get a one -digit number from the user
    while True:
        try:
            user_input = int(input("لطفاً یک عدد یک رقمی وارد کنید (0-9): "))
            if 0 <= user_input <= 9:
                break
            else:
                print("لطفاً یک عدد یک رقمی وارد کنید.")
        except ValueError:
            print("لطفاً یک عدد صحیح وارد کنید.")

    # Find and display coefficients
    factors = find_factors(user_input)
    print(f"ضریب‌های عدد {user_input} که کوچکتر از 100 هستند: {factors}")
Mma123 Download Python
package Tax.App.cmd;
import java.util.Scanner;
public class Find_Zarib {
    public static void main(String[] args) {
        int x = 0;

        Scanner sc = new Scanner(System.in);
        System.out.print("Enter Number between 1 ta 10: ");
        try {
            x = sc.nextInt();

            if (x < 10) {
                for (int i = 1; i < 100; i++) {
                    if (i % x == 0) {
                        System.out.print(i + " ");
                    }
                }
            }else
                System.out.println("Please Valid Number");
        } catch (Exception e) {
            System.out.println("Please Valid Number");
        }
    }
}
Tahabx3 Download Java
number = input("please enter a number: ")
if len(number) != 1:
    print("The number must be a single digit")
else:
    for i in range(1, 100):
        b = i * int(number)
        if b < 100:
            print(b, end=" ")
<< Previous page 1 2 Next page >>

Submit answer

Submitting answers is currently unavailable.

Related content

Detection using AI
×
×
Close