+ 1
C# function input / return result
hey I'm trying to write a code that adds all the numbers between begin and end to the variable x (begin: 5 | end: 10 | 5 + 6 + 7 + 8 + 9 + 10). can someone please explain to me how I solve such problems generally best without getting help from the community every time? I missed the C # course on this topic while studying and can't find it anymore. https://code.sololearn.com/c5A4A8a25a23/#cs
2 Answers
+ 3
Please reread
C# objects, you either need to create an object or your function should be static.(same mistake you made by temperatur)
And reread for loop. The three parts of the for-loop. All have their own purpose.
initialisation, condition, iteration
https://www.tutorialsteacher.com/csharp/csharp-for-loop
https://code.sololearn.com/cSxhxKT5JV9a/?ref=app
+ 5
Your function should be static.