WAP with overloaded methods to implement the following : a. void fn series (int n) --to print all the natural numbers from 1 to n . b. void fnseries (int n1 ,int n2)--- to print all the natural numbers from n1 to n2 where n1 must be greater than n2 , otherwise print "Invalid". c. void fn series (double d1 , fouble d2, int d ) --- to print d number of whole numbers between d1 and d2.
Answers
Answered by
1
Answer:
add_int(int x,int y) - This part of code should be clear that 'add_int' is the name of method and it is taking two parameters of type int.
int add_int(int x,int y) - 'int' before the method name means that this method will return an integer. i.e. we will get some integer value whenever we will call this method.
return x+y; - This part returns an integer having the value 'x+y' since our method has to return an integer.
Now come to the main method
int z = add_int(x+y); - We are calling 'add_int' method by passing two integers 2 and 4. And this will return 'x+y' i.e. '2+4'. So, this statement is equivalent to:
int z = 2+4; or int z = 6; (6) returned by 'add_int(2,4)'.
Explanation:
hope u like that:))
rate me as a brainliest
Similar questions
Math,
5 months ago
Social Sciences,
5 months ago
Economy,
10 months ago
Math,
10 months ago
English,
1 year ago