ONLINE COMPILERS
LIBRARY
MANUAL PAGES & DOCS
CONTACT
Latest Users' Questions
User Submitted Question!
Name: satyam patel
Title:
what is wrong in my program?
Question:
Title:
what is wrong in my program?
Question:
program exponential
implicit none
real::x,sum,term
integer:: n,i,y
print*,"enter the value of x"
read*,x
print*,"enter the value of n"
read*,n
sum=1
term=1
do
i=1,n
term=term*(x/i)
sum=sum term
end do
y=((exp(x)-sum)/exp(x))*100
print*,"sum of exponential series upto n terms=",sum
print*,y
end program exponential
implicit none
real::x,sum,term
integer:: n,i,y
print*,"enter the value of x"
read*,x
print*,"enter the value of n"
read*,n
sum=1
term=1
do
i=1,n
term=term*(x/i)
sum=sum term
end do
y=((exp(x)-sum)/exp(x))*100
print*,"sum of exponential series upto n terms=",sum
print*,y
end program exponential
Name: satyam gaba
no semi-colon used;
wrong syntax,
wrong approach,
everything is wrong with it
and i'm lazy as of now to correct it
take no. of terms as input and define a factorial function and use for/while loop to add the terms
thanks me later