انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة

Exercises in Fortran Programming

Share |
الكلية كلية الهندسة     القسم  الهندسة الميكانيكية     المرحلة 3
أستاذ المادة بسيم عدنان ناظم التويجري       28/10/2016 07:57:58
Input/Output and Arithmetic Operations

Lets write our first program, what we shall do is copy the last program from the text on input/output (shown below) and save it to our UNIX machine. Then on that machine we shall compile the program and run it, to check it works.

PROGRAM PROJEC
************************************************************************
* This program calculates the velocity and height of a projectile *
* given its initial height, initial velocity, and constant *
* acceleration. Variables used are: *
* HGHT0 : initial height *
* HGHT : height at any time *
* VELOC0 : initial vertical velocity *
* VELOC : vertical velocity at any time *
* ACCEL : vertical acceleration *
* TIME : time elapsed since projectile was launched *
* *
* Input: HGHT0, VELOC0, TIME *
* Output: VELOC, HGHT *
************************************************************************

REAL HGHT0, HGHT, VELOC0, VELOC, ACCEL, TIME

ACCEL = -9.807
PRINT *, ENTER THE INITIAL HEIGHT AND VELOCITY:
READ *, HGHT0, VELOC0
PRINT *, ENTER TIME AT WHICH TO CALCULATE HEIGHT AND VELOCITY:
READ *, TIME
HGHT = 0.5 * ACCEL * TIME ** 2 + VELOC0 * TIME + HGHT0
VELOC = ACCEL * TIME + VELOC0
PRINT *, AT TIME , TIME, THE VERTICAL VELOCITY IS , VELOC
PRINT *, AND THE HEIGHT IS , HGHT
END

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Write a program which will convert a temperature of C degrees on the Celsius scale to the corresponding Fahrenheit temperature and display the Fahrenheit temperature. The two scale are related by the following equation:

degF = (9/5)*degC + 32


المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .