C Online Compiler
Example: C Program to Find Factors of a Number using While loop
C
C++
C#
Java
Python
PHP
main.c
STDIN
Run
// C Program to Find Factors of a Number using While loop #include <stdio.h> int main() { int x, i = 1; printf("-----Enter the positive integer number-----\n"); scanf("%d", &x); printf("\nThe factors of the %d are: ", x); while (i <= x) { if (x % i == 0) { printf("%d ", i); } ++i; } printf("\n"); return 0; }
90
Output
Clear
ADVERTISEMENTS