language: Fortran (gfortran-4.3.4)
date: 239 days 1 hour ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
program thefactory
 
!-----------------------------------------------
! -= Dylan Child=-
!
!This is a program that is supposed to factor stuff...
!
!
!
!-----------------------------------------------
 
integer, parameter::dp=selected_real_kind(15)
integer::ioerror,numits
real(dp)::mysum, x,tolerance, realerror
!welcome
   write(*,*)"Hello"
 
 
!get value of x
do
 write(*,"(a)",advance="no") "Please Enter a Value for X that is greater than one --->"
  read(*,*,iostat=ioerror)X
   if (ioerror /= 0) then
   write(*,*)"Error, please enter proper value for X"
       Else
      if (ioerror == 0) exit
 end if
end do
 
!CONVERSION OF NUMITS
  !get value for numits and check for integer
DO
  write(*,"(a)",advance="no") "Please enter a positive number for number of &
iterations --->"
    read(*,*,iostat=ioerror)numits
        if (ioerror /= 0) then
         write(*,*)"please try again"      
        Else
         if (numits >= 0) exit   
   end if
 end do
!mysum=1
!do i=1,numits
!  mysum=mysum+(x**i)/real(facfun(i))
!  write(*,*) i,x**i,facfun(i),x**i/facfun(i),mysum,exp(x)
!end do
 
!Tolareance
  !get tolerance and check for real
  do
     write(*,"(a)",advance="no") "Please enter a tolerance --->"
      read(*,*,iostat=ioerror)tolerance
      if (ioerror /= 0) then
    write(*,*)"Error, please enter proper value for tolerance (like .0001)"
       Else
      if (ioerror == 0) exit
    end if
  end do
 
!Check tolareance
 
!do
!  if(abs(mysum-exp(x) .le. tolerance) exit
!end do
 
!Contains
!--------------------------------
!function
!--------------------------------
 
!Function facfun(N)
!Integer, intent(in) :: numits
!Integer:: factorial, I
 
!Factorial=1
!do I = 2, numits
!     factorial = factorial*I
!End do
 
!end function facfun(N)
 
 
 
End program thefactory
prog.f95:34.1:

iterations --->"
 1
Warning: Missing '&' in continued character constant at (1)
prog.f95:14.15:

real(dp)::mysum, x,tolerance, realerror
               1
Warning: Unused variable 'mysum' declared at (1)
prog.f95:14.39:

real(dp)::mysum, x,tolerance, realerror
                                       1
Warning: Unused variable 'realerror' declared at (1)
  • upload with new input
  • result: Success     time: 0.02s    memory: 2620 kB     returned value: 0

    2
    2
    .001
    
     Hello
    Please Enter a Value for X that is greater than one --->Please enter a positive number for number of iterations --->Please enter a tolerance --->