can anyone solve it?
Attachments:
Answers
Answered by
2
Solution.
The given problems are solved using language - QBASIC.
Question 1:
CLS
INPUT "Enter a number - "; A
IF A MOD 2 <> 0 THEN
PRINT "Number is odd. Number has no even factors."
ELSE
PRINT "Even Factor(s) of the number are - ";
FOR I = 2 TO A STEP 2
IF A MOD I = 0 THEN
PRINT I;
END IF
NEXT I
END IF
END
Question 2:
CLS
INPUT "Enter a number: "; A
SUM = 0
FOR I = 1 TO A - 1
IF A MOD I = 0 THEN
SUM = SUM + I
END IF
NEXT I
PRINT "Sum of factors: "; SUM
END
See attachments for output.
Attachments:
Similar questions
Business Studies,
3 hours ago
Science,
3 hours ago
Math,
5 hours ago
Chemistry,
7 months ago
Computer Science,
7 months ago