Defferen logic result | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Defferen logic result

There are two If cycles. When 'y' is equal to 52000. in the first case, the message is Accept, and in the second, an Error. And there must be a mistake everywhere. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { class Print{ private int x; public int Prins{ get{return x;} set { if (x<=50000) {x=value; Console.WriteLine ("Accept"); } else{ Console.WriteLine (" Error");} } } } static void Main(string[] args) { int y=52000; Print p=new Print (); p.Prins =y; int mark = y; if (mark <= 50000) { Console.WriteLine("accept"); } else { Console.WriteLine("error"); } } } }

15th Aug 2021, 3:37 PM
Пётр Попов
Пётр Попов - avatar
2 Answers
+ 4
Пётр Попов , without having a complete task description we might have to guess what you want to achieve. can you present us the description? thanks!
15th Aug 2021, 7:46 PM
Lothar
Lothar - avatar
0
There are two If cycles. When y= 52000. in the first case, the message is Accept, and in the second, an Error. And there must be "Error"everywhere. Why is this happening. Where is the mistake.
16th Aug 2021, 4:33 AM
Пётр Попов
Пётр Попов - avatar