0
Why mistakes??
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { //используйте возраст в качестве вводных данных int age = Convert.ToInt32(Console.ReadLine()); If(age<=19); {Console.WriteLine("Take your kindle");} } } }
6 Answers
0
Hello,
Yeah, there shouldn't be a ; after the if statement. Also the if should be lowercase not an uppercase 'I' and ensure your if statement is within Main:
static void Main(string[] args)
{
//используйте возраст в качестве вводных данных
int age = Convert.ToInt32(Console.ReadLine());
if(age<=19)
{
Console.WriteLine("Take your kindle");
}
}
+ 7
Don't put ; after if statement and don't put console statement in brackets
+ 1
Thanks for your help
0
Don't working
0
No problem! Happy to help
0
There are a few mistakes in the given code:
The console object should be Console.
The If statement is missing the keyword if.
The if statement has a semicolon at the end.
The code block after the if statement is not enclosed in curly braces.
Here is correct code:
using System;
namespace SoloLearn
{
class Program
{
static void Main(string[] args)
{
// Use age as input
int age = Convert.ToInt32(Console.ReadLine());
if (age <= 19)
{
Console.WriteLine("Take your kindle");
}
}
}
}