Repeatedly print the value of the variable xValue, decreasing it by 0.5 each time, as long as xValue remains positive in c#.
CODE:
using System;
public class HelloWorld
{
public static void Main(string[] args)
{
double xValue;
Console.WriteLine("Enter xValue Which you want to Check:");
xValue = Convert.ToDouble(Console.ReadLine());
for (; xValue > 0; xValue -= 0.5)
{
Console.WriteLine("The xValue:{0}",xValue);
}
Console.WriteLine("The xValue is no longer Positive ");
}
}
Comments
Post a Comment