Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		strNums := strings.Fields(scanner.Text())
		nums := []int{}
		for _, strNum := range strNums {
			num, _ := strconv.Atoi(strNum)
			nums = append(nums, num)
		}
		a := nums[0]
		b := nums[1]
		c := nums[2]
		d := nums[3]
		e := nums[4]
		f := nums[5]
		lcm := lcm(a, d)
		mulA := lcm / a
		mulD := lcm / d
		a *= mulA
		b *= mulA
		c *= mulA
		d *= mulD
		e *= mulD
		f *= mulD

		if d < 0 {
			d *= -1
			e *= -1
			f *= -1
		}

		bE := b - e
		cF := c - f
		y := float64(cF) / float64(bE)
		x := (float64(c) - (y * float64(b))) / float64(a)

		if x == 0 {
			fmt.Printf("%.3f ", 0.0)
		} else {
			fmt.Printf("%.3f ", x)
		}
		if y == 0 {
			fmt.Printf("%.3f\n", 0.0)
		} else {
			fmt.Printf("%.3f\n", y)
		}
	}
}

C++: #include <iostream>
#include <iomanip>
using namespace std;

int main(){
    
    double a,b,c,d,e,f,x,y;
    
    while(cin>>a>>b>>c>>d>>e>>f){
        
        
        if(a!=0)
            y=((d/a)*c-f)/((d/a)*b-e);
        else
            y=c/b;
        
        if(b!=0)
            x=((e/b)*c-f)/((e/b)*a-d);
        else
            x=c/a;
        
        cout<<fixed<<setprecision(3)<<x<<" "<<y<<endl;
    }
}

C++: #include <iostream>
#include <iomanip>
using namespace std;

double ans(double a,double b,double c,double d,double e,double f){
    double y1=b*d;
    double a1=c*d;
    double y2=e*a;
    double a2=f*a;
    double y=y1-y2;
    double a3=a1-a2;
    return a3/y;
}

int main(){
    double a,b,c;
    double d,e,f;
    cin>>a>>b>>c;
    cin>>d>>e>>f;
    double x=ans(b,a,c,e,d,f);
    double y=ans(a,b,c,d,e,f);
    if(x<0||0.001+x>0){
        x=-x;
    }
    if(y<0||0.001+y>0){
        y=-y;
    }
    cout<<fixed<<setprecision(3)<<x<<' '<<setprecision(3)<<y<<endl;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pb push_back

# define inOut(a,b) freopen(a,"r",stdin);freopen(b,"w",stdout);
# define RESET(a) memset(a,0,sizeof(a))
# define MEMO(a) memset(a,-1,sizeof(a))
# define DEBUG puts("Debug-Has-Come-Until-Here")


typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int main(){
	cin.tie(NULL);
	
	int a,b,c,d,e,f;
	double x,y;
	while(scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF){
		//DEBUG;
		x = (double)(c*e - b*f)/(double)(a*e - b*d);
		y = (double)(c*d - a*f)/(double)(b*d - e*a);
		if (fabs(x) < 0.001) x = fabs(x);
		if (fabs(y) < 0.001) y = fabs(y);
		printf("%.3lf %.3lf\n", x,y);
	}

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	double a,b,c,d,e,f,x = 0, y = 0;
	while (~scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f)){
		x = 0; y = 0;
		x = double(b*f - c*e)/double(b*d-a*e);
		y = double(c - a*x)/double(b);
		if (x == 0) x = 0;
		if (y == 0) y = 0;
		printf("%.3lf %.3lf\n", x , y);
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int main(){
        double a,b,c,d,e,f;
        while(cin>>a,cin>>b>>c>>d>>e>>f){
           cout<<setprecision(3)<<fixed<<(f-e/b*c)/(d-e/b*a)<<" "<<(f-d/a*c)/(e-d/a*b)<<endl;
        }
	return(0);
}

C++: #include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main(){
    	int a, b, c, d, e, f;
	double x, y;
	while(1){
	if (!(cin>>a>>b>>c>>d>>e>>f))break;
		x= round( (double)(1000.0/(a*e-b*d))*(e*c-b*f) ) / 1000.0;
		y= round( (double)(1000.0/(a*e-b*d))*(-d*c+a*f)) / 1000.0;
		cout << fixed << setprecision(3) << (double)x << " " << (double)y << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double gcd( double m, double n );
double lcm( double m, double n );
int main(int argc, const char * argv[])
{
    double a=0.0;
    double b=0.0;
    double c=0.0;
    double d=0.0;
    double e=0.0;
    double f=0.0;
    double x=0.0;
    double y=0.0;
    
    while(scanf("%lf",&a)!=EOF){
        scanf("%lf",&b);
        scanf("%lf",&c);
        scanf("%lf",&d);
        scanf("%lf",&e);
        scanf("%lf",&f);
        double ad = lcm( a,d );
        printf("%lf\n",ad);
        
        double a2 = ad/a;
        double b2 = b*a2;
        double c2 = c*a2;
        
        double d2 = ad/d;
        double e2 = e*d2;
        double f2 = f*d2;
        
        y = (c2-f2)/(b2-e2);
        x = (c-b*y)/a;
        
        printf("%.4lf",x);
        printf(" ");
        printf("%.4lf\n",y);
        
    }
    
}
double gcd( double m, double n )
{
	if ( ( 0.0 == m ) || ( 0.0 == n ) )
		return 0;
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

double lcm( double m, double n )
{
	if ( ( 0.0 == m ) || ( 0.0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n);
}

C++: #include<cstdio>

int main(int argc, char const *argv[])
{
    double a, b, c, d, e, f;
    while(scanf("%lf %lf %lf %lf %lf %lf", &a,&b,&c,&d,&e,&f) != EOF){
        double x = (e*c-b*f)/(a*e-b*d);
        double y = (-d*c+a*f)/(a*e-b*d);
        if(x==0) x=0;
        if(y==0) y=0;
        printf("%.3lf %.3lf\n", x, y);
    }
    return 0;
}