Looks like homework. And by the way it has nothing to with C# or .Net for that matter. You need the formula to calculate salary and write it in C# which shouldn't be difficult anyways.
Apart from that, what you wrote is also not logical. Out of 31 days, someone comes to office for 20 days and takes leave of 11 days. googI expect there are weekends as well :).
Google is your friend, try to
search [
^]and I am sure you fill find where you can take inpiration from. :)