Sponsored Content
Top Forums Programming Problem with IF ELSEIF and GOTO statements in FORTRAN Post 302881483 by Akshay Hegde on Sunday 29th of December 2013 03:59:45 PM
Old 12-29-2013
Quote:
Originally Posted by faizlo
Hi

I am reading a book about Fortran 90 and I write the following code, to test my understanding of the first chapter. I have a problem with the last section of the code with deals with an IF, ELSEIF, and GOTO statements. Here is my Code

Code:
PROGRAM sim 
! This code is used to solve two simultaneous 
! equations in two variables with real coefficients: 
! 
!   DATE:        DEVELOPER:              CHANGES: 
!  ------       -----------             ---------- 
!  12/28/13     Faiz Lo                 Original Code 
! 
IMPLICIT NONE  
! Dictionary Data: Declare variables 
REAL :: x, y, a1, b1, a2, b2, c1, c2 
CHARACTER :: Ans  
! Salut message 
WRITE (*,*) '**************************************'

Hai Faizlo, everything is alright except variable declaration for char

make like this and run it should work

Code:
CHARACTER(LEN=3) Ans

This User Gave Thanks to Akshay Hegde For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with my case statements

Hi there, Im having some problems with this function, I pass two arguments to the function $1 $2 (Arguments are month and date inputted by the user) for some reason the case always fails... however in the cases defined below where it shouldnt fail the result is: if it fails with input... (6 Replies)
Discussion started by: Darklight
6 Replies

2. Shell Programming and Scripting

elseif in csh

I have been using the if statement in csh like this if ( $opt1 == 1 ) then ..... elseif ( $opt2 == 1 ) then ...... endif Seems to work, but got Badly placed ()'s. When I used a space in the elseif, a space between the 'else' and the 'if' it worked (0 Replies)
Discussion started by: kristinu
0 Replies

3. Linux

if elseif fi

Hi all, This is my first post in this forum, can i request you to guide, where i am going wrong with the error below. 34: Syntax error: "fi" unexpected (expecting "then") #!/bin/sh argCount=0 mysql_path=$USER_INSTALL_DIR$ for i in $*; do /A argCount+=1 done if ;then echo... (2 Replies)
Discussion started by: oracle_coorgi
2 Replies

4. Shell Programming and Scripting

if elseif fi

Hi, Ihave shifted this thread which i posted in linux forum to here if i am fault please correct me. When i excute this below script i am getting the follwing error can any one please look into it for persual. ./sample_oracle_tradescope.sh: 25: showDEFAULTUsage: not found ... (6 Replies)
Discussion started by: oracle_coorgi
6 Replies

5. Shell Programming and Scripting

Multiple If statements in bash problem

Hi everyone, May you help me with the correct syntax of the follow bash statements please X=10 if ]; then echo "The value is between 1 and 5" for ((i=1;i<=${X})); do echo $i done else if ]; then echo "The value is between 6 and 10" for ((i=1;i<=${X})); do ... (5 Replies)
Discussion started by: Ophiuchus
5 Replies

6. Linux

Fortran compile problem

Hello everyone, I am trying to compile a code under fedora14.Kernel Linux 2.6.35.6-45fc14.i686-GNOME 2.32.0. I use f77,g77 and gfortran to compile but I get the same error all ways. Unsupported OPEN control item at (^) -- ACTION=, ASSOCIATEVARIABLE=, BLOCKSIZE=, BUFFERCOUNT=,... (1 Reply)
Discussion started by: miriammiriam
1 Replies

7. Programming

Removing goto statements in FORTRAN code

I have the code below and I want to remove the "go to" statements. Any idea how I can do it? if (iorder == 0) then tmincurrent = 1.0e11 if(ireverse == 0 .or. istop /= 1) then do i = 1, 6 if ((side(i) /= sidelimit(i)) .and. (tminside(i) < tmincurrent)) then ... (1 Reply)
Discussion started by: kristinu
1 Replies

8. Programming

FORTRAN:Algortihmic Problem

Hi guys I am faced with this problem that I couldn't figure out yet, if you can point me to some direction that'll be of great help. So here's what I want to do. I have let's say 10000 files which contains same number of Z coordinates in each file. I have to find the distance of those... (6 Replies)
Discussion started by: saleheen
6 Replies

9. Shell Programming and Scripting

A dash to GOTO or a dash from GOTO, that is the question...

Well, guys I saw a question about GOTO for Python. So this gave me the inspiration to attempt a GOTO function for 'dash', (bash and ksh too). Machine: MBP OSX 10.14.3, default bash terminal, calling '#!/usr/local/bin/dash'... This is purely a fun project to see if it is possible in PURE... (3 Replies)
Discussion started by: wisecracker
3 Replies
INTRO(3)						     Linux Programmer's Manual							  INTRO(3)

NAME
intro - Introduction to library functions DESCRIPTION
This chapter describes all library functions excluding the library functions described in chapter 2, which implement system calls. There are various function groups which can be identified by a letter which is appended to the chapter number: (3C) These functions, the functions from chapter 2 and from chapter 3S are contained in the C standard library libc, which will be used by cc(1) by default. (3S) These functions are parts of the stdio(3) library. They are contained in the standard C library libc. (3M) These functions are contained in the arithmetic library libm. They are used by the f77(1) FORTRAN compiler by default, but not by the cc(1) C compiler, which needs the option -lm. (3F) These functions are part of the FORTRAN library libF77. There are no special compiler flags needed to use these functions. (3X) Various special libraries. The manual pages documenting their functions specify the library names. AUTHORS
Look at the header of the manual page for the author(s) and copyright conditions. Note that these can be different from page to page! Linux 1995-12-13 INTRO(3)
All times are GMT -4. The time now is 11:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy