Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Seperating a number

Status
Not open for further replies.

Artroxy

Technical User
Jan 25, 2005
1
CA
Hi I'm new to Fortran so I apologize about my question. I need to seperate a number into its individual components so I can put it in an array. For example 123 I'll have to seperate them into different cells of an array (call it X) so x(1) = 1; x(2)=2, x(3)=3 all under. The inputed number (123 in this example) cannot be seperated by a space or anything of the sort. I would appreciate any help I can get.
 
Code:
integer x(3)
read (*,'(3I1)') x
do i = 1, 3, 1
   print *, x(i)
enddo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top