The following examples show a C and Fortran version of the same program.
This program computes PI (with a very simple method) but does not use MPI_Send and MPI_Recv. Instead, it uses collective operations to send data to and from all of the running processes. This gives a different six-function MPI set: