|
|
back to boardJava Posted by Arheus 28 Aug 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); } } } Re: Java Posted by Vlad 29 Aug 2014 23:25 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 big int will be wrong Re: Java Posted by Danila 1 Oct 2014 18:42 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)); } } Re: Java Posted by ACkf 20 Dec 2014 10:54 You should not write any other message than the expected output. Re: Java 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); } } |
|
|