i was trying to do something like this,
i will be given 5 numbers in 5 lines and my program should take only the ith integer from the ith line.
1 2 3 4 5
5 6 7 8 9
10 11 11 13 14
100 2000 300 2 1
7 77 777 7777 77777
so 1 6 11 2 77777
should be taken as input to a array sized 5
how to do it properly with loop? (as you can see, the width of the integer and space between them may vary )
thank you.
upd:
i want to do this with a loop, so that i don't have to type it manually. Also i know it can be done with another array, but as i am learning Format
so i am curious to know if it is possible to do this with formatting.
program selective
implicit none
integer a(5)
integer ignore, i
read(*,*) a(1), ignore, ignore, ignore, ignore
read(*,*) ignore, a(2), ignore, ignore, ignore
read(*,*) ignore, ignore, a(3), ignore, ignore
read(*,*) ignore, ignore, ignore, a(4), ignore
read(*,*) ignore, ignore, ignore, ignore, a(5)
write(*,*) (a(i), i=1,5)
end program selective