Write the following C programs ifelse statements Create a pr
Solution
using System.IO;
using System;
class Program1
{
static void Main()
{
double input;
Console.WriteLine(\"Enter a double value : \");
double.TryParse(Console.ReadLine(), out input);
if (input == 0.5) {
Console.WriteLine(\"HALF\");
}
else {
Console.WriteLine(\"NOT-HALF\");
}
}
}
---------------------------------------------------------------------------------------------------------
using System.IO;
using System;
class Program2
{
static void Main()
{
int input;
Console.WriteLine(\"Enter Your Age : \");
int.TryParse(Console.ReadLine(), out input);
if (input>=13 && input <=19) {
Console.WriteLine(\"You are a teenager\");
}
else {
Console.WriteLine(\"You are NOT a teenager\");
}
}
}
