/****************************/
/* 複数結果の受け渡し */
/* coded by Y.Suganuma */
/****************************/
import java.io.*;
public class Test {
static int n; // 以下の関数にすべて有効
public static void main(String args[]) throws IOException
{
int a, b, ind;
int res[] = new int [1];
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
/*
データの入力
*/
System.out.print("aの値は? ");
a = Integer.parseInt(in.readLine());
System.out.print("bの値は? ");
b = Integer.parseInt(in.readLine());
System.out.print("nの値は? ");
n = Integer.parseInt(in.readLine());
/*
関数の呼び出し
*/
ind = sub(a, b, res); // 変数resは配列で渡す
/*
結果の出力
*/
if (ind == 0)
System.out.println("n " + n + " result " + res[0]);
else
System.out.println("n < 0 (n " + n + ")");
}
/*****************************/
/* (a+b)/nの計算 */
/* a,b : データ */
/* res : 計算結果 */
/* return : =0 : normal */
/* =1 : n < 0 */
/*****************************/
static int sub(int a, int b, int res[])
{
int ind;
if (n == 0) {
ind = 1;
n = 100;
}
else {
ind = 0;
res[0] = (a + b) / n;
}
return ind;
}
}