fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int num1, num2, i;
  5.  
  6. printf("Enter the first integer: ");
  7. scanf("%d", &num1);
  8.  
  9. printf("Enter the second integer: ");
  10. scanf("%d", &num2);
  11.  
  12. printf("Common factors of %d and %d are: ", num1, num2);
  13.  
  14. for(i=1; i<=num1 && i<=num2; i++) {
  15. if(num1%i==0 && num2%i==0) {
  16. printf("%d", i);
  17. }
  18. printf("None");
  19. }
  20.  
  21. return 0;
  22. }
  23.  
  24.  
Success #stdin #stdout 0s 5440KB
stdin
Standard input is empty
stdout
Enter the first integer: Enter the second integer: Common factors of -968813984 and 21917 are: