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");} } } }

4th Jan 2023, 6:23 AM
Мирас
Мирас - avatar
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"); } }
4th Jan 2023, 4:04 PM
Hassanah
Hassanah - avatar
+ 7
Don't put ; after if statement and don't put console statement in brackets
4th Jan 2023, 7:55 AM
Hasnain [ACTIVE CHALLENGER]
Hasnain [ACTIVE CHALLENGER] - avatar
+ 1
Thanks for your help
4th Jan 2023, 4:17 PM
Мирас
Мирас - avatar
0
Don't working
4th Jan 2023, 8:03 AM
Мирас
Мирас - avatar
0
No problem! Happy to help
4th Jan 2023, 4:19 PM
Hassanah
Hassanah - avatar
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"); } } } }
5th Jan 2023, 9:41 PM
Aditya Dixit