fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. /**1回目テスト**/
  14. int testI1 = 100;
  15. /**2回目テスト**/
  16. int testI2 = 66;
  17. /**3回目テスト**/
  18. int testI3 = 33;
  19. //int型の平均点を計算
  20. int averageInt = ( testI1 + testI2 + testI3)/3;
  21. //int型の平均点を計算
  22. System.out.println("平均は" +averageInt +"点です。");
  23.  
  24. /**1回目テスト**/
  25. float testF1 = testI1;
  26. /**2回目テスト**/
  27. float testF2 = testI2;
  28. /**3回目テスト**/
  29. float testF3 = testI3;
  30. //float型の平均点を計算
  31. float averageFloat = (testF1 + testF2 + testF3)/3;
  32. //float型の平均点を計算
  33. System.out.println("平均は" +averageFloat +"点です。");
  34.  
  35. /**1回目テスト**/
  36. double testD1 = testF1;
  37. /**2回目テスト**/
  38. double testD2 = testF2;
  39. /**3回目テスト**/
  40. double testD3 = testF3;
  41. //doouble型の平均点を計算
  42. double averageDouble = (testD1 + testD2 + testD3)/3;
  43. //double型の平均点を計算
  44. System.out.println("平均は" +averageDouble +"点です。");
  45.  
  46. }
  47. }
Success #stdin #stdout 0.12s 36372KB
stdin
Standard input is empty
stdout
平均は66点です。
平均は66.333336点です。
平均は66.33333333333333点です。