Skip to content

Instantly share code, notes, and snippets.

@koluku
Last active November 28, 2016 03:38
Show Gist options
  • Save koluku/970069c892b123c1bae381e04338777f to your computer and use it in GitHub Desktop.
Save koluku/970069c892b123c1bae381e04338777f to your computer and use it in GitHub Desktop.
/*
* Exercise 8-1b, factor.c
*/
#include <stdio.h>
int main(void){
int i, j;
int fa[8];
for(i = 0; i < 8; i++) {
scanf("%d", &fa[i]);
}
int o=0;
for(i = 0; i < 8; i++) {
for(j = i+1; j < 8; j++) {
if(fa[j]%fa[i] == 0) {
printf("%d %d\n", fa[i], fa[j]);
o++;
}
else if(fa[i]%fa[j] == 0) {
printf("%d %d\n", fa[i], fa[j]);
o++;
}
}
}
if(o == 0) {
printf("none.\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment