Why C and Fortran and (C++)?


C was created in 1972 specifically to implement the UNIX operating system so to:
  1. Allow the operating system to be portable.
     
  2. Through optimization, provide assembly language level performance.
As such, it is provides a suitable framework for high performance computing platforms.
 
FORTRAN, was released in 1957 using the first compiler ever developed. The idea was to create a programming language that would be to allow complex mathematical expressions to be coded in a manner similar to regular algebraic notation and then compiled into efficient machine language.
 
It was found that programmers were able to write programs 5 times faster than before with performance reduced by only 20%. Again this provides a suitable framework for high performance computing platforms, and in a language targeted as scientific computation.

C and Assembly

#include <stdlib.h>
#include <stdio.h>
int main (void) {
    int x=2, y=3, sum,result;      
    __asm__ ("movl %1, %0;"
                      "addl %2, %0;"
                       : "=r" (sum) : "r" (x), "r" (y): "0");              

    printf("\n%i + %i = %i\n",x,y, sum);
    result=sum*sum;
    printf("\n%i*%i = %i\n",sum,sum, result);
    return 0;
}

 


Professor Nathan Sprague's Machine Assembly Language Notes.

Some Fortran