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
2
Answer:
- To print the factors of a numbers in BASIC
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
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