package com.codegym.task.task04.task0412;
/*
Positive and negative numbers
*/
import java.io.*;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) throws Exception {
Scanner scanner = new Scanner(System.in);
int num = scanner.readInt();
if(number>=0){
System.out.println(number*2);
}else if(number<0){
System.out.println(number++);
}else if(number==0){
System.out.println(0);
}
}
}
Please help I am stuck on level 4 lesson 4
Under discussion
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Oleh
21 April 2019, 19:51useful
It's hard to help you without task/error text. Help section can automatically generate all needed information.
So I can only guess without this one. As I see, third statement will never work even if number equals zero. Every time number equals zero first if will be done and everything else will not execute.
+1
edis emin
22 April 2019, 17:31
thanks for the help
0