質問編集履歴

2

書式の改善

2018/06/25 12:35

投稿

takashi.f
takashi.f

スコア45

test CHANGED
@@ -1 +1 @@
1
- fortran90のコンパイルエラー
1
+ 結果が常にゼロで出力される
test CHANGED
@@ -1,8 +1,6 @@
1
- fortran90のプログラムです。下記エラーよりコンパイルが通りせん。
1
+ fortran90のプログラムです。結果が常ゼロで出力されてしいます
2
2
 
3
- Interface mismatch in global procedure ‘sigma’ at (1): 'sigma' has the wrong number of arguments [-Wargument-mismatch]
4
3
 
5
- intent属性を色々いじってみたのですが、解決しませんでした。
6
4
 
7
5
  コンパイラはgfortran、OSはubuntsuを使っています。
8
6
 
@@ -74,6 +72,56 @@
74
72
 
75
73
 
76
74
 
75
+ subroutine SIGMA(v,a,b,s)
76
+
77
+ implicit none
78
+
79
+ integer ::a ,b !
80
+
81
+ integer ::v
82
+
83
+ integer ::x
84
+
85
+ integer ::i ,s
86
+
87
+
88
+
89
+
90
+
91
+ interface
92
+
93
+ subroutine func(x,v)
94
+
95
+ implicit none
96
+
97
+ integer ::v
98
+
99
+ integer ::x
100
+
101
+ end subroutine
102
+
103
+ end interface
104
+
105
+
106
+
107
+ call func(x,v)
108
+
109
+ s=0
110
+
111
+ do i= a,b
112
+
113
+ x=i
114
+
115
+ s=s+v
116
+
117
+ end do
118
+
119
+ return
120
+
121
+ end subroutine SIGMA
122
+
123
+
124
+
77
125
 
78
126
 
79
127
  ```

1

書式の改善

2018/06/25 12:35

投稿

takashi.f
takashi.f

スコア45

test CHANGED
File without changes
test CHANGED
@@ -19,20 +19,6 @@
19
19
  integer::a,b,s,v
20
20
 
21
21
 
22
-
23
- ! interface
24
-
25
- ! subroutine func(x)
26
-
27
- ! implicit none
28
-
29
- ! integer ::v
30
-
31
- ! integer,intent(in)::x
32
-
33
- ! end subroutine
34
-
35
- ! end interface
36
22
 
37
23
 
38
24