Friday, September 2, 2016

Read Underlined Digits and Print

Write  a  program  that  reads  the  underlined  digits  as  individual  integers  . Then  add 1  to  each  integer   and  print  them  .
 
                     123456
           297645
           356987


Program Coding :

Program Individuals_Integer
 Implicit none
 integer ::  N(3) , i
  open(unit=1 ,  File = "Input.dat" )
  open(unit=2 ,  File = "Output.dat" )
 Read(1,21) ( N(i), i = 1, 3)
 21 format ( / , / , 3 (1x , I1))
       Do i = 1 , 3
           N(i) = N(i) + 1             !Adding 1 to each integer
      end do
      Do i = 1 , 3
          write (2,12)  N(i)
          12 format (I2)
          end do

 end program


Input:




Output:





No comments:

Post a Comment