diff --git a/count.rb b/count.rb old mode 100644 new mode 100755 index 7f99d41..adff980 --- a/count.rb +++ b/count.rb @@ -1,13 +1,34 @@ - #!/usr/bin/env ruby # -*- coding: utf-8 -*- -count = 0 +print"好きな数字入れて!\n" +kou=gets.to_i +printf"%dの約数は\n",kou +yaku=0 -while count < 44 - count += 1 - if count % 3 != 0 - next +while yaku<=kou + + yaku +=1 + if kou % yaku==0 + printf"%d\n",yaku end - printf("3の倍数は%d\n",count) end + + print"好きな数字を入れてね!\n" + suu=gets.to_i + printf"%dの約数は\n",suu + a=0 + +while a<=suu + + a +=1 + if suu % a==0 + printf"%d\n",a + + end +end + + + + + diff --git a/gengou.rb b/gengou.rb index 0bae7f5..9b840de 100755 --- a/gengou.rb +++ b/gengou.rb @@ -11,7 +11,7 @@ kotae=gets.chomp.to_i if kotae==2 puts"ブブー不正解・・・自分のs4の画像にヒントがあるよ!" - break + redo elsif kotae==1 puts"正解よくわっかたね!" @@ -36,15 +36,15 @@ if kota==1 puts"ブブー不正解・・・ヒント、派手かも" - break + redo elsif kota==2 puts"ブブー不正解・・・ヒント、派手かも" - break + redo elsif kota==3 puts"ブブー不正解・・・ヒント、派手かも" - break + redo elsif kota==4 puts"ピンポンピンポン大正解すごいね!" diff --git a/tasizan.rb b/tasizan.rb index db229a0..334596c 100755 --- a/tasizan.rb +++ b/tasizan.rb @@ -3,7 +3,7 @@ -print"たしざんをするよ!\n" +print"掛け算をするよ!\n" print"数を入力してね。\n" kazu=gets.to_i print"足す数を入力してね。\n"