diff --git a/Q7.Check whether two numbers are co-prime or not.c b/Q7.Check whether two numbers are co-prime or not.c new file mode 100644 index 0000000..6075ca4 --- /dev/null +++ b/Q7.Check whether two numbers are co-prime or not.c @@ -0,0 +1,31 @@ +#include + + +int main() +{ + int num1, num2, h, i; + + printf("Enter two numbers: "); + scanf("%d%d", &num1, &num2); + + + for(i=1;i<=num1;i++) + { + if(num1%i==0 && num2%i==0) + { + h = i; + } + } + + + if(h == 1) + { + printf("%d and %d are co-prime.", num1, num2); + } + else + { + printf("%d and %d are not co-prime.", num1, num2); + } + + +}