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 := cF / bE
		x := (c - (y * b)) / a

		fmt.Printf("%d.000 ", x)
		fmt.Printf("%d.000\n", y)
	}
}

C++: #include <iomanip>
#include <iostream>
#include <vector>
#define N 2
 
using namespace std;
typedef vector< vector<double> > Equation;
 
int main()
{ 
    Equation c(N, vector<double>(N + 1));
	while (cin)
	{
		// input
		for (int i = 0; i < N; ++i)
			for (int j = 0; j < N + 1; ++j)
				cin >> c[i][j];

		// Gaussian elimination
		// 1. Forward elimination
        for (int i = 0; i < N - 1; ++i)
            for (int j = i + 1; j < N; ++j)
            {
                double d = c[j][i] / c[i][i];
                for (int k = i + 1; k <= N; ++k)
                    c[j][k] -= c[i][k] * d;
            }
 
		// 2. Back substitution
        for (int i = N - 1; i >= 0; --i)
        {
            double d = c[i][N];
            for (int j = i + 1; j < N; ++j)
                d -= c[i][j] * c[j][N];
            c[i][N] = d / c[i][i];
        }
 
        cout << setprecision(3) << fixed << c[0][N];
        for (int i = 1; i < N; ++i)
            cout << " " << c[i][N];
        cout << endl;
    }
 
    return 0;
}

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

int main(void){
	double a,b,c,d,e,f;
	double x,y;
	cout << fixed;
	cout.precision(3);
	while(cin >> a >>b >> c >> d >> e >>f){
		b/=a; c/=a; a=1.0;
		e/=d; f/=d; d=1.0;
		y=(c-f)/(b-e); if(y==0) y=0;
		x=c-b*y; if(x==0) x=0.0;
		cout << x << " " << y << endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include<math.h>
double sg(double x){
	if ( x > 0.0 ) {
		return floor(x + 0.0005);
	} else {
    	return -0.001 * floor(fabs(x) + 0.0005);
	}
}
int main(){
	double a,b,c,d,e,f,x,y;
	while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)!=EOF){
		y=sg(((c*d)-(a*f))/((b*d)-(a*e)));
		x=sg(((c*e)-(b*f))/((a*e)-(b*d)));
		printf("%4lf %4lf\n",x,y);
	}
	return 0;
}

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

int main(){
	double a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	double x, y;
	y = (a * f - d * c) / (a * e - d * b);
	x = (c - b * y) / a

	//小数点以下４桁で四捨五入して表示
	cout << fixed << setprecision(3) << x << " " << y << endl;

	return 0;
}

C++: #include <iostream>
using namespace std;
int main()
{
	double a,b,c,d,e,f;
	while(cin>>a>>b>>c>>d>>e>>f)
	{
		double x = (c*e-f*b)/(a*e-b*d);
		double y = (c*d-f*a)/(b*d-a*e);
		printf( "%.3f %.3f\n",x+1e-10,y+1e-10);
	}
	return 0;
}

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

using namespace std;

int main() {

	double a, b, c, d, e, f,x,y;

	while (cin >> a >> b >> c >> d >> e >> f) {
		
		x = (c*e - b*f) / (a*e-b*d)+0.0;
		y = (c*d - a*f) / (b*d - a*e)+0.0;

		printf("%.3lf %.3lf\n",x,y);

	}

	return 0;

}

C++: using System;

// ガウス・ジョルダン法
// https://www.mk-mode.com/blog/2013/09/20/cpp-simultaneous-equation-by-gauss-jorden/#

namespace Prob0004
{
    class Program
    {
        static void Main(string[] args)
        {

            const int COLUMN = 2;
            const int ROW = 3;

            string line;
            while((line = Console.ReadLine()) != null)
            {
                // a[0][0]x + a[0][1]y = a[0][2]
                // a[1][0]x + a[1][1]y = a[1][2]
                string[] tokens = line.Split(' ');
                double[,] a = new double[COLUMN, ROW];
                for(int y = 0; y < COLUMN; y++)
                {
                    for (int x = 0; x < ROW; x++)
                    {
                        a[y, x] = double.Parse(tokens[y * ROW + x]);
                    }
                }


                for(int y = 0; y < COLUMN; y++)
                {
                    for (int x = 0; x < ROW; x++)
                    {
                        Console.Write("{0} ", a[y, x]);
                    }
                    Console.WriteLine("");
                }


                // pivot = (p, p)
                double coef;
                for (int p = 0; p < ROW - 1; p++)
                {

                    // ピボットのある行要素への処理
                    coef = a[p, p];
                    for (int x = p; x < ROW; x++)
                    { 
                        a[p, x] /= coef;
                    }

                    // ピボット以外の行要素への処理
                    for (int y = 0; y < COLUMN; y++)
                    {
                        if(p == y)
                        {
                            continue;
                        }

                        coef = a[y, p];
                        for (int x = p; x < ROW; x++)
                        {
                            a[y, x] -= a[p, x] * coef;
                        }
                    }

                    /*
                                        Console.WriteLine("");
                                        for (int y = 0; y < COLUMN; y++)
                                        {
                                            for (int x = 0; x < ROW; x++)
                                            {
                                                Console.Write("{0} ", a[y, x]);
                                            }
                                            Console.WriteLine("");
                                        }
                                        Console.WriteLine("");
                    */
                }

                // outputs
                for (int y = 0; y < COLUMN; y++)
                {
                    Console.Write("{0} ", a[y, ROW - 1].ToString("F3"));
                }
                Console.WriteLine();
            }

        }



    }
}

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;
		printf("%f %f\n",x,y);
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
using namespace std;
int main(){
	double a, b, c, d, e, f;
	double x = 0, y = 0;
	while(cin >> a >> b >> c >> d >> e >> f){
	      x = (1 / (a*e - b*d))*(c*e - f*b);
	      y = (1 / (a*e - b*d))*(a*f - d*c);
	      printf("%4.3f\n",x);
	      printf("%4.3f\n",y);
        }
	return 0;
}

C++: //08
#include<iostream>
#include<iomanip>
#include<cmath>

using namespace std;

int main(){
  for(double a,b,c,d,e,f;cin>>a>>b>>c>>d>>e>>f;){
    double x=(c*e-f*b)/(a*e-d*b);
    double y;
    if(e){
      y=(f-d*x)/e;
    }else{
      y=(c-a*x)/b;
    }
    if(fabs(x)<1e-4){
      x=0;
    }
    if(fabs(y)<1e-4){
      y=0;
    }
    cout<<fixed<<setprecision(3)<<x<<' '<<y<<endl;
  }
  return 0;
}