sorry, forgot to take out the &...
real:: testx
!now to input and figure out f(x)
write(*,*) 'Enter real number for X '
read(*,*) testx
write(*,*) 'Solving for F(X)...'
do i=1, nr_elements
read(1,*) x(i), y(i)
if(x(i) < testx < x(i+1)) then
write(*,*) 'Y = ', y(i) = (y(i+1) - y(i)) /...
This is what i have.. but it doesn't work, theres an error in the if statement
real:: testx
!now to input and figure out f(x)
write(*,*) 'Enter real number for X '
read(*,*) testx
write(*,*) 'Solving for F(X)...'
do i=1, nr_elements
read(1,*) x(i), y(i)
if(x(i) < testx < x(i+1)) then...
@ gullipe: how did you figure that out?
@ mikrom: thanks, that makes a lot of sense.
the last thing i cannot figure out is how to code this part in:
(If the value is out of range, print a message.) Test your program with the following x-values: -7.8, 1.1234, 13.65, 22.5, 23.5914, 25, 25.085...
i think your equation is close, but my teacher told us to use this one: (yes i know that f(x) is the same thing as y)
f(x) = f(i) +[f(i+1)-f(i)] / [x(i+1)-x(i)] * (xo -xi)
xo is the value to be input by the user i guess.
I've gotten some of the program written out already but this is one of...
Hey guys. I've been assigned this project for my intro to fortran90 class and I have no idea where to begin. Could someone give me a sample code for it?
The following data represents discrete values of a function for which an explicit formula is not known:
1.123400 167.5600...
trying to write a program that will do a truncated infinite series to calculate the sin of x. I need the do loop to end when the term is within the user input for accuracy.
anybody know how i can finish it?
i've got this so far.
Program sinx
Implicit none
!declare variables
real::x, sum...
hi mikrom,
that program works, but i'm not sure i understand it exactly.
is there any way you could add something to my code to make it print the number of times the letter appears?
program countletter
implicit none
integer::i,j
integer::numberoftimes
character::letter
character::letter1
character(len=30)::sentence = "I don't know how to do it."
write(*,*)'Enter a letter'
read(*,*)letter
write(*,*)"You chose the letter '",letter, "' and the number of times it appear$...
I'm trying to create a program that assigns a sentence to a given character variable, prompts the user to input a letter, and then outputs how many times that letter is in the assigned sentence. I'm trying to do this with a simple do loop..
completely stuck. could anyone show me a code that...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.