Why is this code returning the wrong gcd?

Code:#include <iostream> using namespace std; int gcd(int a,int b); int main() { double a = 0; double b = 0; cout << "Enter two integers and I will report their gcd: " << endl; cin >> a,b; cout << gcd(a,b) << endl; return 0; } int gcd(int a, int b) { while ( b !=0 ) { int t = b; b = a % b; a = t; } return a; }