Why my code doesnt work? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why my code doesnt work?

I wrote code true but sololearn dont acces me to use jump fanction Code : c++ #include <iostream> using namespace std; int main() { int a, b; cin >> a; int c = a - 50; int d = 50 - c; if (d > 50); d = d - 50; jump 10; else; cout << d; return 0; }

20th Jul 2022, 1:08 PM
Mahdoosh1
Mahdoosh1 - avatar
5 Answers
+ 4
Are you trying to solve the transportation code coach challenge? if so, then you should follow the task suggestion, to make use of the modulo operator in calculation.
20th Jul 2022, 1:44 PM
Ipang
+ 3
What is jump mean by there, what it can do there? Is it valid statement in cpp? Sry, I never heard about.. Between you have a semicolon after if statement. Remove it.. after else also.
20th Jul 2022, 1:13 PM
Jayakrishna 🇮🇳
+ 1
Did you find the answer ? if not 1.remove semicolons for if and else statement. 2.there is no statement called jump. There are two statements break and continue. 3. give instruction after else statement. 4. If you want to write more than two lines for decision making statements, you need to use curly braces. 5. you declared 'b' but didn't used. 6.I don't know what your purpose by writing this code, but it will only give negative value because you are subtracting again and again.
20th Jul 2022, 2:36 PM
Sohhiyyi
Sohhiyyi - avatar
0
Remove the semi colon on else
21st Jul 2022, 3:48 PM
Razyl Abbygail Vidal
Razyl Abbygail Vidal - avatar
0
Ipang i dont know how do modulo operator works What is modulo
26th Jul 2022, 10:27 AM
Mahdoosh1
Mahdoosh1 - avatar