- 1

Int res= ____( ____2,____99,5); ? Any one help me

the method using named arguments with the values 5 for "from", 99 for "to" and 2 for "step": static int calc(int from, int to, int step=1) { int res-0; for(int i=from;i<toit=step) { res += i; } return res; } static void Main(stringl args) { int res= ____(______2,___99,5); ((( iwant to know fill in the blanks ))) Console.WriteLine(res

29th Jan 2020, 2:03 PM
Ehsan Wattoo
5 Answers
+ 4
Daljeet Singh thankssss bro
29th Jan 2020, 2:43 PM
Ehsan Wattoo
+ 1
Since you typed all this Why don't you make a code out of it and test run it you have four values to test Just like I did it is your corrected code using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static int calc(int from, int to, int step=1) { int res = 0; for(int i=from;i<to;i+=step) { res += i; } return res; } static void Main(string[] args){ int res= calc(step:2,to:99,from:5); Console.WriteLine(res); } } }
29th Jan 2020, 2:39 PM
Daljeet Singh
Daljeet Singh - avatar
0
Did you try to enter wrong answer? Then "comments" button appears. Press the button and comment section appears with 100 comments telling the right answer.
29th Jan 2020, 2:27 PM
Seb TheS
Seb TheS - avatar
0
Seb TheS brother plz tell me answer i not find and answer thanksssss
29th Jan 2020, 2:39 PM
Ehsan Wattoo
0
void Swap( ref int x, ref int y) { int temp; temp = x; x = y; y = temp; }
14th Aug 2021, 2:53 AM
Mahbub E Waduzzaman
Mahbub E Waduzzaman - avatar