1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import java.io.*;
class Rei7_3{
public static void main(String[] args) throws
IOException{
BufferedReader br = new
BufferedReader(
new InputStreamReader(System.in));
System.out.print
("-1を入力するまで繰り返す:");
String str = br.readLine();
int a = Integer.parseInt(str);
//-1でないとき繰り返す
//-1を入力したときは終了する
while(a != -1){
System.out.print
("-1を入力するまで繰り返す:");
str = br.readLine();
a = Integer.parseInt(str);
}
}
}
|
using System;
class Rei7_3{
static void Main(){
Console.Write
("-1を入力するまで繰り返す:");
string str = Console.ReadLine();
int a = Convert.ToInt32(str);
//-1でないとき繰り返す
//-1を入力したときは終了する
while(a != -1){
Console.Write
("-1を入力するまで繰り返す:");
str = Console.ReadLine();
a = Convert.ToInt32(str);
}
}
}
|