Mega Code Archive

 
Categories / C / Code Snippets
 

More calculation in the for statement

#include <stdio.h> int main(void) { int num, j; printf("Enter the number to test: "); scanf("%d", &num); for( j = 2; j < (num / 3) + 1; j = j + 2) if( ( num % j ) == 0) printf("%d ", j); return 0; }