This program takes a positive integer from the user and displays all the positive factors of that number.
Example: Factors of a Positive Integer
printf("Enter a positive integer: ");
printf("Factors of %d are: ", number);
for(i=1; i <= number; ++i)
if (number%i == 0)
Enter a positive integer: 60
Factors of 60 are: 1 2 3 4 5 6 12 15 20 30 60
In the program, a positive integer entered by the user is stored in variable number.
The for loop is iterated until i <= number is false. In each iteration, whether number is exactly divisible by i is checked (condition for i to be the factor of number) and the value of i is incremented by 1.