Register to reply

Printing certain values from a DO loop in Fortran

by johnwalton84
Tags: fortran, loop, printing, values
Share this thread:
Dec7-04, 08:01 AM
P: 16
I've written a program in Fortran which has a do loop of the form

do i=0,20000


end do

I want the program to print the values of the do loop, but only want it to print every 100th value of i (i.e. 100,200,300,400...20000), can anyone suggest a way to do this?
Phys.Org News Partner Science news on
Fungus deadly to AIDS patients found to grow on trees
Canola genome sequence reveals evolutionary 'love triangle'
Scientists uncover clues to role of magnetism in iron-based superconductors
Dec7-04, 08:19 AM
P: 345
if (mod(i,100) .eq. 0) then
print stuff
Dec7-04, 08:43 AM
P: 16
Would that not only work for i=100 though? If i is 200 then the mod(200,100) wouldn't be 0 so it wouldn't print?

Dec7-04, 09:37 AM
P: 16
Printing certain values from a DO loop in Fortran

Obviously not cos its worked

Thanks for that imabug!

Register to reply

Related Discussions
Riding a Loop the Loop (velocity at the bottom of the loop) Introductory Physics Homework 13
Fortran v.s. Visual Fortran Programming & Computer Science 0
Binomial Theorem - small values of x and approximate values Precalculus Mathematics Homework 7
C prog: printing values from array of structures Computing & Technology 36
PDF and printing Computing & Technology 13