forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

A real issue using Fortran 95

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
Carl_Mesaros



Joined: 28 Nov 2016
Posts: 6

PostPosted: Mon May 08, 2017 3:14 pm    Post subject: A real issue using Fortran 95 Reply with quote

Dear Silverfrost Community:
I believe that this would be a better way of stating my issue. I apologize for not putting it this way sooner.

I am trying to write an answer to the above exercise using the Silverfrost
FTN95 Express compiler:

Write a program that reads in an integer and outputs a statement telling
whether or not the integer is evenly divisible by 3. If this integer is not
evenly divisible by 3, the program should output the remainder obtained
when the number is divided by 3. Use a compound statement inside an
IF-THEN-ELSE construct.

Could I use the MOD intrinsic function in writing the answer to the above
exercise and, if I can, how do I do this? Thank you.

Best regards,
Carl Mesaros
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 674

PostPosted: Mon May 08, 2017 3:33 pm    Post subject: Reply with quote

Whether you are allowed to use the MOD function or not is a question that you should direct to your instructor.

The purpose assigning such simple homework problems is to give you a focus for reading your text book or Fortran manuals. Instead of asking for a solution, you should think about the problem, make an earnest attempt to solve it and, if you do not succeed, show what you have done and ask some specific questions. Then use the replies that you may receive to complete the solution.
Back to top
View user's profile Send private message
Carl_Mesaros



Joined: 28 Nov 2016
Posts: 6

PostPosted: Mon May 08, 2017 5:39 pm    Post subject: Reply with quote

Dear mecej4:
This question arises honestly from self study. I am not formally associated
with any school. Thank you. Smile

Best regards,
Carl Mesaros
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 674

PostPosted: Mon May 08, 2017 7:55 pm    Post subject: Reply with quote

With or without MOD(), the task that you described can be programmed in about ten lines of code. You have the compiler. You don't have an instructor who is limiting what constructs you can use. I suggest that you write and try out various versions of the program. Even when one of those versions is not working correctly, there may be some good points that are worth observing. You will learn something quite useful about integer arithmetic.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group