Question:

Can't spot the problem with this.. (novice...

by  |  earlier

0 LIKES UnLike

This is a program that is supposed to find the greatest common divisor of two different numbers. It compiled without error but when I try to run it, it spits out a error like "floating point error core dumped" after I've entered the two numbers. Any help would be much appreciated.-Dylan Nash#include <stdio.hint gcd(int, int);int main() { int x, y; printf("Find the GCD of what two numbers: "); scanf("%d%d", &x, &y); printf("The GCD is %d\n", gcd(x, y)); return 0; int gcd(int a, int b) { int i, result = 0; for (i = 0; i <= a || i <= b; i++) { if (a % i == 0 && b % i == 0) result = i; } return result;

 Tags:

   Report
Please Login to view 3 answers to this question

Question Stats

Latest activity: earlier.
This question has 3 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.