Notes
Notes - notes.io |
!050200102
module hw5
public :: hw5subroutine
contains
subroutine hw5subroutine(x, y, a, b, n)
integer:: j, n
real, dimension(:), intent(in):: x, y
real, intent(out) :: a, b
real:: sum_x, sum_y, sum_xx, sum_xy
sum_x=0
sum_y=0
sum_xx=0
sum_xy=0
do j=1,n
sum_x=sum_x+x(j)
sum_y=sum_y+y(j)
sum_xy=sum_xy+x(j)*y(j)
sum_xx=sum_xx+x(j)**2
end do
a=((sum_x*sum_y)-(n*sum_xy))/((sum_x**2)-(n*sum_xx))
b=(sum_y-(a*sum_x))/n
end subroutine hw5subroutine
end module hw5
program hwork5
use hw5
implicit none
real,dimension(8) :: x, y
integer:: i,n
real:: a, b
n=8
open(unit=3, file="C:UsersulfenDesktopinputhw5.txt", status="old", action="read", position="rewind")
do i=1, 8
read(unit=3,fmt="(F5.2,T6,F5.2)") x(i), y(i)
write(*,fmt="(2x,F5.2,x,F5.2)") x(i), y(i)
end do
call hw5subroutine(x, y, a, b, n)
write(*,*) "a value is ", a, " b value is ", b
close(unit=3, status="keep")
end program hwork5
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team