Modify the fortran program given below to incorporate changes.
click here to view the Fortran pgm for today's
assignment
Instructions on how to run the fortran pgm p235.f90
- Make a directory called fortran, to compile and run fortran programs here!
$ mkdir fortran
- Goto the directory fortran
$ cd fortran
- Copy the fortran program , by using the cp command
$ cp ~abhay/fortran/p235.f90 .
- The compiler to compile this program is f90 Compile the program.
$ f90 p235.f90
- Find the executable file a.out created by using ls
$ ls
- Now execute the program
$ ./a.out
- Type in a number.
Now do the following:
- Read the fortran code p235.f90.
- Follow the instructions given above to run the pgm.
- Note down the time taken to run the pgm.
- The above program prints the first N 235 numbers where N is the number read in.
A 235 number is a number which is completely divisible by 2 , 3 and 5 alone.
a) Find out the 153rd, 247th (235)numbers.
- Now modify the given program to incorporate
the following changes.
b) Change the program to find first N numbers divisible by 7 and 11 alone.
c) [OPTIONAL] Find how many numbers are lesser than a number X(which is to be read in)
- Mail the modified programs to your TA
NOTE: Consult your TA whenever in doubt !!
HOME