How do i solve this question for C#? This is what i wrote but as you can see, it doesn't work (I'm new to C# i need explanation) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do i solve this question for C#? This is what i wrote but as you can see, it doesn't work (I'm new to C# i need explanation)

https://code.sololearn.com/cHn096ubND3r/?ref=app

2nd Nov 2021, 4:36 AM
Kaniitou
Kaniitou - avatar
4 Answers
+ 2
As stated the WriteLiene cannot be assigned to a variable, its value is void. Provide a numeric data type for your num variable, and assign it to with r*r When using int, this will look like this: int num = r*r;
2nd Nov 2021, 4:57 AM
Erlénio.RS
Erlénio.RS - avatar
+ 1
MrFruitL You have defined radius and taking input in another variable? where did you define num? Formula for area is (pi * r * r) and what are you doing doens't make sense. What is the reason to assign Console.WriteLine(r*r) in num? Take some time to understand concepts otherwise you will not learn anything.
2nd Nov 2021, 4:55 AM
A͢J
A͢J - avatar
0
MrFruitL Console.WriteLine() is use to print so you can't assign it in any variable. Take some time to understand concepts.
2nd Nov 2021, 4:51 AM
A͢J
A͢J - avatar
0
Hmmm alright thanks, i learned C# 5 months ago and stopped. I guess i got pretty self confident. Thanks
2nd Nov 2021, 5:03 AM
Kaniitou
Kaniitou - avatar