You can't grab code at random from the internet, chuck it into a C# file, and get a working app: the two languages are very very different, and just share some common syntax.
Much of what makes C work is not going to work in C#: it doesn't use pointers (except in tightly control circumstances) and C doesn't have any clue about classes or references. And while both have a
struct
keyword, they use it for very different things.
If you need a C# solution, write C# code.
These may help you:
Console.ReadLine Method (System) | Microsoft Docs[
^]
Int32.TryParse Method (System) | Microsoft Docs[
^]
Double.TryParse Method (System) | Microsoft Docs[
^]