0% found this document useful (0 votes)
7 views4 pages

Sheet 1

Uploaded by

jokerhtfn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views4 pages

Sheet 1

Uploaded by

jokerhtfn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Electrical Department

First Year, 1st Semester


Programming Language (A)
Sheet 1

Aswan University Faculty of Engineering

1. Which of the following are invalid names in Fortran and why?


firstnumber, NUM_1, Student.name, Program, 2021, X, price$, y(t), num-1

2. Determine the value of the following expressions:


a) 2 * 3 / 12 * 8 / 4
b) 2.0 * 3.0 / 12.0 * 8.0 / 4.0
c) 2 * 3. / 12 * 8 / 4
d) 2 * 3 / 12 * 8. / 4.

3. Are the following statements legal or illegal? If they are legal, what is their
result? If they are illegal what is wrong with them?
PROGRAM prog1
INTEGER :: i,j
INTEGER, PARAMETER :: K = 4
i = k**2
j = i/k
k = i+j
WRITE(*,*) i,j,k
END PROGRAM prog1
Electrical Department
First Year, 1st Semester
Programming Language (A)
Sheet 1

Aswan University Faculty of Engineering

4. What value is stored in result after the following statements are executed?
INTEGER :: a,c
REAL :: b,result
a = 10
b = 1.5
c = 5
result = FLOOR(a / b) + b * c ** 2

5. What is the output of the following programs?


a.

b.

c.

d.
Electrical Department
First Year, 1st Semester
Programming Language (A)
Sheet 1

Aswan University Faculty of Engineering

6. Write a Fortran program that asks the user for his name and greets him with his
name.

7. Write a Fortran program that reads two numbers and prints the sum (addition),
multiply, subtract, divide and remainder of the two numbers.

8. Write a Fortran program to find the third angle of a triangle if two angles are
given.

9. Write a Fortran program that takes three numbers as input to calculate and print
the average of the numbers

10. Write a Fortran program that converts kilometers per hour to miles per hour.

11. Write a Fortran program that reads in the radius and length of a cylinder and
compute volume using the following formulas:
Area = radius * radius * π
Volume = Area * length

12. Write a Fortran program that calculates the equivalent resistance of four
resistors R1, R2, R3, and R4 connected in parallel.
Electrical Department
First Year, 1st Semester
Programming Language (A)
Sheet 1

Aswan University Faculty of Engineering

13. Write a Fortran program that takes hours and minutes as input and calculates
the total number of minutes.

14. Write a Fortran program to convert a given integer (in seconds) to hours,
minutes, and seconds.

15. Write a Fortran program to add two 4-bit binary numbers. (*)

16. Write a Fortran program to swap two variables.

17. Rewrite the previous program without using third variable. (*)

18. Write a Fortran program that accepts an employee's ID, total worked hours of a
month and the amount he received per hour. Print the employee's ID and salary
(with two decimal places) of a particular month. (*)

19. Write a Fortran program to compute the distance between two points on the
surface of earth.

20. Write a Fortran program that reads the coefficients a, b, and c of a quadratic
equation: 𝑎𝑥2 + 𝑏𝑥 + 𝑐 = 0 and displays its solution.

You might also like