0
Why is this code showing no output?
My code keeps showing no output why ?. I'm using c#.Here's the code: I was trying to solving lab numbers community challenge. https://code.sololearn.com/cq22yT7DD2xI/?ref=app
3 ответов
+ 1
Check it your self its your last if condition not true in any of the input check it your self
+ 2
for (int n = 2;n <= x/2;x++) //here you x++,
{
if (x%n==0 && input/Math.Pow(n, 2)==0)
According to these conditions, when x=4, this loop starts.. 2<=4/2 is true, but input/4==0 false, next x=5, x%n==0 false,
x=6, loop condition 2<=6/2 false..
After x=8, all loops stop without any printing..
+ 1
Because the conditions of the code never happen