Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Cairo University Engineering Programming Language

Faculty of Engineering Graduate Studies


Irrigation and Hydraulics Dept.

ARRAY ASSIGNMENT
1) Pascal's matrix P is defined by
• P(i,1) = 1 for all i
• P(1,j) = 1 for all j
• P(i,j) = P(i-1,j) + P(i,j-1) for i,j > 1
a) Write a Fortran program that computes Pascal's matrix of order N. You may
assume n is less than or equal to Nmax=40 in your declaration, but the actual
value of N should be given by the user at run time
b) What happens if the user inputs a value that is greater than Nmax? Write your
program so that you can deal with this eventuality.
2) Imagine that your department has asked you to write a program that records
students’ exam marks. Every student who scores more than 60% and less than 70
has passed the exam with grade D. Student who scores more than or equal 70%
and less than 80 get C, Student who scores more than or equal 80% and less than
90 get B, and Student who scores more than or equal 90% get A. You will need to
use arrays to record the students’ names, their marks (the input method either
from screen or input file you have to provide the two options for the user). After
obtaining the results the program should calculate whether the students have
passed and their grades. The department has also asked that you calculate the total
number who have passed, the average mark, the percentage of each grade letter,
and identify the person with the top mark. Write a program which processes
results for up to 50 students and produces output similar to the following:

Student Mark Grade


Villa 64 D
Drogba 57 F
Xavi 78 C
Iniesta 71 C
Gerrard 65 D
Messi 95 A
Rooney 85 B
Ronaldo 94 A
Torres 37 F
Kaka 82 B

No.of passes = 8
Average mark = 72.8
% of F grade = 20%
% of D grade = 20%
% of C grade = 20%
% of B grade = 20%
% of A grade = 20%
Prize awarded to Messi

You might also like