Computer Science, asked by rakhijain195, 6 months ago

3. Basic Program: (6*3=181
a) WAP to print the factors of a number. (For example the factors of
6 are 1,2,3,6 factors of 9 are 1, 3,9). Use FOR-NEXT statement​

Answers

Answered by BrainlyProgrammer
2

Answer:

\huge\star\underbrace{\mathtt\orange{⫷❥QuEsTiOn⫸}}\star

  • To print the factors of a numbers in BASIC

\huge\star\underbrace{\mathtt\red{⫷❥ᴀ᭄} \mathtt\green{n~ }\mathtt\blue{ §} \mathtt\purple{₩}\mathtt\orange{Σ} \mathtt\pink{R⫸}}\star

CLS

PRINT"ENTER A NUMBER"

INPUT N

FOR I=1 TO N

IF N MOD I=0

THEN PRINT I

NEXT I

END

Answered by anindyaadhikari13
1

Correct Question:-

➡ Write a program to print the factors of a number.

Program:-

CLS

INPUT "Enter a number: ",A

PRINT "Factors are as follows..."

FOR I=1 TO A STEP 1

IF A MOD I = 0 THEN

PRINT I+" "

END IF

NEXT I

END

This is a simple program. At first, we will input the number and then we will create a loop that will iterate from 1 to A. Inside the loop, we will check if any of the numbers is a factor of A or not. If true, then we will print the numbers.

Similar questions