Announcement

Collapse
No announcement yet.

desperate for help regarding fortran

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    desperate for help regarding fortran

    i need help with my fortran hw. if anyone knows anything about it, please shed some light.

    the problem is:
    Suppose that a row of mailboxes is numbered from 1 to 150 and that beginning with mailbox 2, we open the doors of all the even-numbered mailboxes. Next, beginning with mailbox 3, we go to every third mailbox, opening its door if it is closed and closing it if it is open. we repeat this procedure with every fourth mailbox, then every fifth, and so on. write a program to determine which mailboxes will be closed when this procedure is completed.

    the problem is due tomorrow! and im freaking out.
    thnx in advance.

    #2
    also im using fortran 77 and the topic of the assignment is on arrays.

    Comment


      #3
      Is this High school HW? If yes than holy shit I'm dumb.

      Dr. Jekyll by day Mr. Hyde by night
      ----
      02 Pontiac Firebird W68
      92 Dodge Stealth RT/TT

      Comment


        #4
        haha nah man, it's for a college course

        Comment


          #5
          Well serves me right for not going to college.

          Dr. Jekyll by day Mr. Hyde by night
          ----
          02 Pontiac Firebird W68
          92 Dodge Stealth RT/TT

          Comment


            #6
            I imagine only for people going to college to learn programming, but sorry I only got an introduction to C, never programmed in fortran

            on the stairs, she grabs my arm, says whats up,
            where you been, is something wrong?
            i try to just smile, and say everything’s fine.

            Comment


              #7
              I dont know FORTRAN speicifically, but create 150 arrays, numbered 0-149 (this will make things difficult, because now evens are technically odd.)

              when does it want to you stop, when you get to 150?

              if so, write an if statement that defines i = 2, and increase the value of i after every iteration, stopping at 150. use that i to tell it what mailbox to open/close. make another variable, ill make it boolean so we can use true or false, to show if its open or closed. inside that statement, you would use another if/else statement that says something like
              "if (variable = true)
              {
              variable = false;
              }
              else
              {
              variable = true;
              }"

              sorry if that looks nothing like FORTRAN, thats written in C++.

              hope that helps.
              -Mark-
              CB7
              CD5


              And if i could swim I'd swim out to you in the ocean
              Swim out to where you were floating in the dark.

              Comment


                #8
                thnx for the responses

                that gives me an idea, but the C++ is totally foreign to me :-\

                anyone with the patience to write me a program? :-P

                Comment


                  #9
                  nevermind guys. i got it.

                  Comment

                  Working...
                  X