I m not sure what's wrong with my code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I m not sure what's wrong with my code?

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { int b=25; int a=93; do{ a=(a<b)? a:b; Console.WriteLine(a); a+=b;}while (a>b); } } }

10th Aug 2017, 7:27 PM
cloudwu
5 Answers
+ 3
Replace the left parenthesis with (. The problem is that the left parenthesis is some other character. It looks italisized, or something like that. Having those parethesis themselves isn't an issue though. I assume you copy and pasted it from somewhere else, whether or not you wrote the code. Sometimes those things can happen. (It's also an infinite loop)
11th Aug 2017, 2:00 AM
Rrestoring faith
Rrestoring faith - avatar
+ 2
1. Syntax error: (a<b)? You need to change first symbol to correct '(' 2. Infinity loop because a>b always: 93>25 => a=b=25 a = 25 + 25 = 50 50>25 => a=b=25 ...and again...
10th Aug 2017, 10:53 PM
Oleg Mikelson
Oleg Mikelson - avatar
+ 1
Just remove the ( Brackets ) Then your code is supposed to work :)
10th Aug 2017, 9:20 PM
Limitless
Limitless - avatar
+ 1
thanks all of you
26th Aug 2017, 4:50 PM
cloudwu
0
So what is wrong ? Is there a error or a unexpected output ?
10th Aug 2017, 7:45 PM
sneeze
sneeze - avatar