SEE Class 10 Nepal | Computer Science | QBASIC | C- Programming | Solutions

SEE Class 10 Nepal | Computer Science | QBASIC | C- Programming | Solutions

Published On: June 27th, 2023
Program to display the multiplication table of any supplied number: 
CLS
INPUT "Enter any number ";num
i = 1
DO
  product = num * i
  PRINT num;" x ";i;" = ";product
  i = i+1
LOOP WHILE i<=10
END
Program to display the first 10 natural numbers and their sum.
CLS
i=1
sum=0
DO
  PRINT "number: ";i
  sum=sum+i
  PRINT "Sum: ";sum
  i=i+1
LOOP WHILE i<=10
END
Program to ask any number and displays its factors.
CLS
INPUT "Enter any number";num
i=1
DO
  IF num MOD i = 0 THEN
   PRINT i; " is the factor of ";num
  END IF
  i=i+1
LOOP WHILE i<=num
END

Factors of any number are those natural numbers that can divide the original number without leaving any remainder (or makes remainder 0). Example: Since, there are only 9 natural numbers, from 1 to 9, we can check the factors by dividing 9 by 1 to 9 each. Thus, we can conclude that only 1, 3 and 9 are factors of 9.

In the above program, MOD returns the remainder so if "num" is divided by "i" (counter/increment value) and the remainder is 0 then that particular value of "i" is the remainder of "num".