Console.Write("{0}", age);
}
Please what does the{0} mean in the program below.....
class AGE
{
static void Main()
{
Console.WriteLine("Input your age:");
int age =Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Your age after 10 years is:");
age = age+10;
Console.Write("{0}", age);
}
}
}
Jignesh KumarPosted Oct 13, 2022, 8:36 AM
Hello Michael Abram,
Here {0} is place holder for variable which holds value for that variable. Hre age is int varialble so what ever value is assign to age variable this will placed at {0}
In above program use will input at 5 then it will
age = 5 + 10;
so it will be 15 inside {0} and it will print on the screen.