Answer the question
In order to leave comments, you need to log in
How to output 2 variables from a function?
I need to output days and S
Here is my code
public static double While3(double n)
{
double S = 0;
int d = 10,
sumd = 200,
days = 1;
while (S < sumd)
{
days++;
S += d + (d * ( n / 100));
}
return days,S;
}
Answer the question
In order to leave comments, you need to log in
Use tuples.
public static (int, double) While3(double n)
{
double S = 0;
int d = 10,
sumd = 200,
days = 1;
while (S < sumd)
{
days++;
S += d + (d * ( n / 100));
}
return (days,S);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question