第4講 if文
第6話 5教科の最高点と最低点を算出する
kuh
を実現するプログラム例
#! ruby -Ks
k=rand(101)
sy=rand(101)
sg=rand(101)
r=rand(101)
e=rand(101)
g=k+sy+sg+r+e
h=g.to_f/5
print "国語=",k,"\n"
print "社会=",sy,"\n"
print "数学=",sg,"\n"
print "理科=",r,"\n"
print "英語=",e,"\n"
print "合計=",g,"\n"
print "平均=",h,"\n"
if g>=300 then
 print "合格\n"
else
 print "不合格\n"
end
w=100
if w>k then w=k end
if w>sy then w=sy end
if w>sg then w=sg end
if w>r then w=r end
if w>e then w=e end
print "5教科の最低得点は",w,"です。\n"
w=0
if w<k then w=k end
if w<sy then w=sy end
if w<sg then w=sg end
if w<r then w=r end
if w<e then w=e end
print "5教科の最高得点は",w,"です"
参考ダウンロード添付ファイル


さらに、ソース(コード=プログラムの文章)を改良して、
最高得点の教科と最低得点の教科も表示するようにして下さい。
gb
結構難しい課題ですが、
諦めずに自分の頭で考えて、
必ず成功させて下さい。

第5話へ 第7話へ
004


eclipse c++ 入門
魔方陣 数独で学ぶ VBA 入門
数独のシンプルな解き方・簡単な解法の研究
vc++講義へ
vba 2013 2010 2007 入門へ
VB講義基礎へ
初心者のための世界で一番わかりやすいVisual C++入門基礎講座へ
初心者のための世界で一番わかりやすいVisual Basic入門基礎講座へ
専門用語なしの C言語 C++ 入門(Visual C++ 2010で学ぶ C言語 C++ 入門)
専門用語なしの excel vba マクロ 入門 2013 2010 2007 対応講義 第1部
eclipse java 入門へ
excel 2016 vba 入門第1部へ
本サイトトップへ