im trying to do the most basic c# program to show my college class and for some reason a couple of simple if statements are messing up my whole small program
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("do you have a pet?");
Console.WriteLine("Y/N");
string yn = Console.ReadLine();
if (yn == "N")
{
Console.WriteLine("well.....you should!!");
}
if (yn == "Y")
{
Console.WriteLine("good!! what kind of pet is he?");
string type = Console.ReadLine();
Console.WriteLine("i love " + type + "s!!!");
Console.WriteLine("how old is he?");
int chanan = Console.Read();
if (chanan > 10)
{
Console.WriteLine("you should probably start thinking about a funeral");
Console.ReadLine();
}
if (chanan < 10)
{
Console.WriteLine("well then you have a nice long time to go with him");
Console.WriteLine("i think were done here....goodbye");
Console.ReadLine();
}
}
Console.WriteLine("press ENTER to exit....");
Console.ReadLine();
}
}
}
when it asks how old he is, you input a number and it puts it in the age variable and for some reason ti adds 48 to the variable.......i see absolutely no reason for this especially since there isnt any arithmetic in the whole program
good luck trying to help
binny