You are on page 1of 2

University of Barishal

Department of Mathematics
Assignment: 1
B.S. (Honors) second year second semester, Session: 2019-2020
Course Title: Math Lab II, Course No.: MTH-219

Name:
Roll:

Use FILE and FORMAT for any kind of input and output unless otherwise specified.
SL Problem Signature
(C.Teacher)
1. Write a single Fortran program to determine the values of q, r, s and t for each x  [1,1] .
Use increment 0.1 for x.
2
(i ) q    x  2  2.4 (ii) r  log x  2  x1
x
(iii) s  sin 2 2 x  cos2 2 x (iv) t  sin 1 x  tan 1 x
Display the results in a table of heading x, q, r, s and t.
2. Write a FORTRAN program to find the surface area and volume of a sphere with a given
radius.
3. The first two Fibonacci numbers are 1 and 1. And the next number can be determined by
adding up the previous two numbers. Write a Fortran program to find the first n  10
Fibonacci numbers. Also find the sum of these Fibonacci numbers. Show your results in
the following format

1 1 2
3 5 8
  
  
4. Use an array to store a list of n  10 integers. When the value of n is given, the memory
size will be allocated for the elements of the array. Also, sort and write the numbers in both
ascending and descending order with proper heading.
5. Write a Fortran program to determine whether a positive integer, n  1 is prime or not. If
the number is composite, print all the divisors.
6. Write a Fortran program to print the first, n  20 prime numbers which are greater than 30.
7. Write an IF-THEN-ELSE-ENDIF block that reads a temperature in degree 𝐶and print an
appropriate message with the following criteria:
Temperature ≤ 00 𝐶 Print “It’s below freezing”
0 𝐶 <Temperature≤ 220 𝐶
0 Print “It’s cold out”
0 0 Print “It’s normal”
22 𝐶 <Temperature≤ 28 𝐶
280 𝐶 <Temperature≤ 400 𝐶 Print “It’s warm”
Temperature > 400 𝐶 Print “It’s hot”
8. Assume that values is a 101-element array containing a list of measurements from
scientific experiment, which has been declared by the statement
Real, Dimension(-50:50) :: values
Write the Fortran statements that would count the number of positive values, negative
values, and zero values in the array and then write out a message summarizing how many
values of each type were found?
9. Use array to write a Fortran program which print the given 20 integer values in an
ascending order and where each row has exactly five values.
10. Suppose a set of data consisting n>5 positive real numbers is given. Write a fortran
program to calculate the mean, median and standard deviation of the given set of data.
Read the given set of data from a disk file.
11. Let the function f(x,y) is defined as follows
x  y x  0 and y  0

x  y x  0 and y  0
2

f ( x, y)   2
x  y x  0 and y  0
 x2  y 2 x  0 and y  0

Write a Fortran subprogram to evaluate f(x,y) for all possible combination of x and y. Be
sure to use nested IF construct.

You might also like