Register to reply 
Printing certain values from a DO loop in Fortran 
Share this thread: 
#1
Dec704, 08:01 AM

P: 16

I've written a program in Fortran which has a do loop of the form
do i=0,20000 (operations) 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? 


#2
Dec704, 08:19 AM

P: 345

if (mod(i,100) .eq. 0) then
print stuff endif 


#3
Dec704, 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?



#4
Dec704, 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 