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 <cstdio>

int main(){
	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){
		x = (double)(e*c-b*f)/(e*a-b*d);
		y = (double) (c-a*x)/b;
		if(0.00049>x && x> -0.00049) x=0;
		if(0.00049>y && y> -0.00049) y=0;
		printf("%.3f %.3f\n",x,y);
	}
	return 0;
}

C++: #include <iostream>
#include <iomanip>
using namespace std;
int main() {
    double a,b,c,d,e,f;
    double x, y;
    while (cin>>a>>b>>c>>d>>e>>f) {
        x = (e*c - b*f) / (a*e - b*d);
        y = (-d*c + a*f) / (a*e - b*d);
        cout << fixed << setprecision(3) << x << " " << y << endl;
    }
}

C++: #include<iostream>
#include <iomanip>

int main(){
double a,b,c,d,e,f,a_,b_,c_,d_,e_,f_;
double x,y;
double in;
while (std::cin >>a>>b>>c>>d>>e>>f){
in = (a*e - b*d);
a_ = a/in;
b_ = -1*d/in;
d = -1*b/in;
e_ = e/in;
x = c * a_ + f*b_;
y = c*d_ + f*e_;
std::cout << std::setprecision(3) << std::fixed << x << ' ' << std::setprecision(3) << std::fixed <<  y << std::endl;
}
    return 0;
}

C++: #include <iostream>
#include <stdio.h>
using namespace std;
  
int main(void){
    double a,b,c,d,e,f,delta,kai,kait;
    while(1){
	    if( scanf("%f %f %f %f %f %f",&a,&b,&c,&d,&e,&f) == EOF) break;
		delta=a*d-b*c;
		kai=(d*e-b*f)/(delta);
		kait=(a*f-e*c)/(delta);
		printf("%.3f %.3f\n",kai,kait);
    }
    return 0;
}

C++: #include<iostream>

using namespace std;
   
void Simultaneous()
{
    double a, b, c, d, e, f;
    double x, y;
      
    while(cin>>a>>b>>c>>d>>e>>f)  
    {
        x = ( c * e - b * f ) / ( a * e - b * d );
        y = ( a * f - c * d ) / ( a * e - b * d );
        
        cout.setf(ios::fixed); //"setf" is used for “half-adjusting”
        cout.precision(3); //precision is used for rould off three places of decimals
        
        //if value is 0, and there is half-adjusting function below, then the output would be "-0", needs to change it to "0"
        if(x == 0)
        {
            x = 0;
        }
        
        if(y == 0)
        {
            y = 0;
        }
        
        cout<<x<<" "<<y<<endl;
    }
            
    return;
}
     
int main()
{     
    Simultaneous();
    return 0;
}

C++: #include <stdio.h>

int main(){
  int a, b, c, d, e, f;
  std::cin >> a;
  std::cin >> b;
  std::cin >> c;
  std::cin >> d;
  std::cin >> e;
  std::cin >> f;
  
  double x, y;
  x = (c*e-b*f) / (a*e-b*d);
  y = (a*f-c*d) / (a*e-b*d);
  printf("%f.3 %f.3\n", x, y);
  
  return 0;
}

C++: #include<iostream>
#include<iomanip>
using namespace std;
int main(void){
    float a,b,c,d,e,f,x,y;
    while(cin>>a>>b>>c>>d>>e>>f){
        x=(e*c-b*f)/(a*e-b*d);
        y=(-d*c+a*f)/(a*e-b*d);
        if(x==0)x=0;
        if(y==0)y=0;
        cout<<fixed<<setprecision(3)<<x<<" "<<fixed<<setprecision(3)<<y<<endl;
        }
        return 0;
}

C++: #include<stdio.h>
#include<math.h>

int main(void){
	double x1[1000],y1[1000];
	int a[1000],b[1000],c[1000],d[1000],e[1000],f[1000],i=0,j,r=0,x2[1000],y2[1000];
    
    while(r==0)
	{
		scanf("%d %d %d %d %d %d",&a[i],&b[i],&c[i],&d[i],&e[i],&f[i]);
	    x2[i] = (c[i] * e[i] -b[i] * d[i]) / (a[i] * e[i] - b[i] * d[i])*1000+0.5;
	    y2[i] = (d[i] * c[i] -a[i] * f[i]) / (b[i] * d[i] - a[i] * e[i])*1000+0.5;

		if(a[i] < -1000 || a[i] > 1000  || b[i] < -1000 || b[i] > 1000 ||
		   c[i] < -1000 || c[i] > 1000  || d[i] < -1000 || d[i] > 1000 || 
		   e[i] < -1000  || e[i] > 1000 || f[i] < -1000 || f[i] > 1000)break;
		
		i=i+1;
	}
	for(j=0;j<i;j++)
	{
		x1[j]=x2[j]/1000;
		y1[j]=y2[j]/1000;
		printf("%f %f\n",x1[j],y1[j]);
	}
  return 0;
}

C++: #include<iostream>
#include<stdio.h>
using namespace std;

int main() {
	double a = 0, b = 0, c = 0, d = 0, e = 0, f = 0;
	double x, y;
	while (cin >> a >> b >> c >> d >> e >> f) {
		b /= a;
		c /= a;
		e /= d;
		f /= d;
		y = (c - f) / (b - e);
		x = f - e * y;
		printf("%.3lf %.3lf\n", x, y);
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

template<typename T> void simultaneous_equation(T &x, T &y, T a, T b, T c, T d, T e, T f)
{
	if (a == 0 || b == 0 || d == 0 || e == 0)
	{
		if (a == 0)
		{
			y = c / b;
			x = (f - e * y) / d;
		}
		else if (b == 0)
		{
			x = c / a;
			y = (f - d * x) / e;
		}

		if (d == 0)
		{
			y = f / e;
			x = (c - b * y) / a;
		}
		else if (e == 0)
		{
			x = f / d;
			y = (c - a * x) / b;
		}
	}
	else
	{
		double a0 = a * e;
		double c0 = c * e;

		double d0 = d * b;
		double f0 = f * b;

		x = (f0 - c0) / (d0 - a0) + 0;

		y = (c - a * x) / b + 0;
	}
}

int main()
{
	double a, b, c, d, e, f;
	for (; cin >> a >> b >> c >> d >> e >> f;)
	{
		double x, y;

		simultaneous_equation(x, y, a, b, c, d, e, f);
		cout << fixed << setprecision(3) << x << " " << y << endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

int main() {

  for (Real a,b,c,d,e,f; cin >> a >> b >> c >> d >> e >> f, cin; ) {

    Real det = a * e - b * d;
    Real x = e * c - b * f;
    Real y = - d * c + a * f;
    x /= det;
    y /= det;
    if (x == -0.0) x = 0.0;
    if (y == -0.0) y = 0.0;
    printf("%0.3f %0.3f\n", x, y);

  }

  return 0;
}

C++: /*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0004&lang=jp*/

#include <iostream>

using namespace std;

int main(){
    double a, b, c, d, e, f;
    while(cin>>a>>b>>c>>d>>e>>f) {
        printf("%.3f %.3f\n",((int)((c * e - b * f) / (a * e - b * d)*10e3+0.5))/10e3,((int)((a * f - c * d) / (a * e - b * d)*10e3+0.5))/10e3);
    }
    return 0;
}