program main c*********************************************************************72 c cc MAIN is the main program for SUM_MILLION. c c Discussion: c c SUM_MILLION is a sketch of a program to generate the numbers c from 1 to 1,000,000, add them, and print the result. c c This program is only a sketch. Your job is to finish it, c debug it, and get it to run. c c Read the CPU clock this way: c c call cpu_time ( ctime1 ) c integer n parameter ( n = 1000000 ) double precision ctime double precision ctime1 double precision ctime2 double precision error double precision exact integer flops integer i double precision mflops double precision total double precision x(n) exact = 500000500000.0D+00 write ( *, * ) ' ' write ( *, * ) 'SUM_MILLION:' write ( *, * ) ' FORTRAN77 version' write ( *, * ) ' ' write ( *, * ) ' Task: add the numbers from 1 to ', n c c Step 1: c Load the array X with the values. c do i = 1, n x(i) = i end do c c Step 2: c Start the clock. c Add up the entries in X. c Stop the clock. c Compute elapsed CPU time; c Set the number of FLOPs. c Compute the MFLOPS rate. c Compute the error. c MISSING CODE c c Step 3: c Print results. c write ( *, * ) ' ' write ( *, * ) ' Total = ', total write ( *, * ) ' Error = ', error write ( *, * ) ' CPU time = ', ctime write ( *, * ) ' MFLOPS = ', mflops stop end