-->

Write a program to display all the factors of a number excluding the number itself using INT() function.

Write a program to display all the factors of a number excluding the number itself using INT() function.

QBasic Code: 

Cls

Rem To display factors of a number, excluding the number itself, using INT() Function

Input "ENTER THE NUMBER TO GET THE FACTORS:", N

Print "THE FACTORS ARE: "

For I = 1 To N / 2

    If N / I = Int(N / I) Then Print I

Next I

End

Output:

ENTER THE NUMBER TO GET THE FACTORS: 6

THE FACTORS ARE:

1

2

3

You May Like Also Also Like This

Post a Comment

0 Comments