Tasks with and without asterisks
Comments (52)
- Popular
- New
- Old
You must be signed in to leave a comment
Luke
19 February, 05:18
Codegym you think you're sooooo smart making us include -1 in the summation ;)
0
Rather Be Coding
26 August 2023, 23:13
So, you want to add -1 as well? Strange if we're breaking when that is entered.
0
Reganralph
15 June 2022, 12:33
int b = 0;
while (true){
int a = Integer.parseInt(bb.readLine());
if (a<=-1){
b = b+a;
System.out.println(b);
break; }
b=b+a;
}
please cna i get help as to why this SAYS
Be sure that the program works correctly with negative numbers.
0
rags 3
5 July 2023, 23:19
you need your if statement farther down i think below b+a
0
Ali_Alshehri
19 May 2022, 15:56
I use bubble sort algo
to order number and then print the middle one
+1
Romant QA
17 April 2022, 09:26
Hi guys! To my mind, the Best way of learning the Codegym course is following.
(1) Solve tasks by your own, using the Codegym help section, comments, or even web search - its really ok! Get used to it.
(2) After you Verified a task, Download correct solution. >> Push the Help button in the task menu.
(3) Correct your own solution in efficient and short way.
Actually, it was the best way to correct my code and understand it.
Sometimes I had Bullshit-code, dont know how it worked %)))))
0
Nikita Petrov Controls engineer
9 March 2022, 12:38
I used 3 attempts to understand that in the "Adding" task "<0" and "== -1" are not the same.
+1
Romant QA
2 March 2022, 16:21
Adding was tricky. Used for loop for(;a>0;a++ )
and a= -1 to end the loop. Break didnt work
0
DFW
23 February 2022, 17:08
Could someone please check my code for "Somewhere in the middle"? It outputs the middle number, but when I try to verify I dont pass the "Program should display middle number". Any help would be great! Thanks
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
byte a = Byte.parseByte(reader.readLine());
byte b = Byte.parseByte(reader.readLine());
byte c = Byte.parseByte(reader.readLine());
if ((a<=b && a>=c) || (a>=b && a<=c)){
System.out.println(a);
} else if ((b<=a && b>=c) || (b>=a && b<=c)){
System.out.println(b);
} else {
System.out.println(c);
}
+2
Anonymous #10821319
3 May 2023, 00:27
May be you need to use:
int a = Integer.parseInt(reader.readLine())
and not
byte a = Byte.parseByte(reader.readLine());
0
Carlos M
21 January 2022, 03:53
Watch out for Q3, the program must include -1 so your output will be 52.
+3
Mark Makombe Full Stack Developer at ICAP
20 January 2022, 15:13
on somewhere in the middle problem I used the Math library, just wondering if thats allowed
+1