C Online Compiler
Example: C Program to Find Factors of a Number using Do While loop
C
C++
C#
Java
Python
PHP
main.c
STDIN
Run
// C Program to Find Factors of a Number using Do 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); do { if (x % i == 0) { printf("%d ", i); } ++i; } while (i <= x); printf("\n"); return 0; }
70
Output
Clear
ADVERTISEMENTS