My actual input doesn't reflect on the Console | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

My actual input doesn't reflect on the Console

Console.WriteLine("Type your three digit number here : "); int a = Convert.ToInt32(Console.Read()); int b = Convert.ToInt32(Console.Read()); int c = Convert.ToInt32(Console.Read()); int inputValue = (100*a + 10*b + c); if (a*a*a + b*b*b + c*c*c == inputValue) { Console.WriteLine("Your three digit number is {0}Yes", inputValue); } else { Console.WriteLine("Your three digit number is {0} No", inputValue); My question is. if I input 371, it shows that my input was 5255. why does this happen here only? In visual studio, it works just fine. somebody help.

5th Sep 2018, 6:42 AM
Sunit Kumar Chattoraj
Sunit Kumar Chattoraj - avatar
1 Answer
0
This is a noob-ish code I made for 3digit Armstrong number. My problem is, I can't make any other way to separate the digits and use those separated digits. Also I cant use loops. I mean I understand those loops and what they do. but I don't get how they do it. so I cant use them.
5th Sep 2018, 6:45 AM
Sunit Kumar Chattoraj
Sunit Kumar Chattoraj - avatar