|
|
вернуться в форумПоказать все сообщения Спрятать все сообщенияJava Arheus 28 авг 2014 01:04 What is wrong? import java.util.*; public class Main { public static void main(String[] args){ int a,b = 0;
Scanner in = new Scanner(System.in);
System.out.println("First num"); a = in.nextInt(); if(a==1){ System.out.println("Second num"); b = in.nextInt();} if(b==5){ System.out.println(a+b); } } } You should not write any other message than the expected output. How should the compiler know that writing "First num" and "Second num" isn't part of the problem result? Edited by author 29.08.2014 23:25 Re: Java towangyanqing@foxmail.com 11 сен 2014 09:00 What is the problem import java.util.Scanner; public class Summa { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan=new Scanner( System.in); System.out.println("Введите значение a"); int a; a=scan.nextInt(); System.out.println("Введите значение b"); int b; b=scan.nextInt(); System.out.println(" a + b = " + (a + b)); } } You should not write any other message than the expected output. what is the problem? package Acm; import java.util.Scanner; public class Num { public static void main(String[] args) { // TODO Auto-generated method stub Scanner numscanner = new Scanner(System.in); int a = numscanner.nextInt(); int b = numscanner.nextInt(); System.out.println(a + b); } } |
|
|