1.

WAP to accept a number and print its factors.(for loop)

Answer»

Explanation:

LOGIC to find all FACTORS of a number

Input number from user. Store it in some VARIABLE say num .

Run a loop from 1 to num , increment 1 in each iteration. The loop STRUCTURE should look like for(i=1; i<=num; i++) .

For each iteration inside loop check current counter loop variable i is a factor of num or not.



Discussion

No Comment Found