Question

Explain how methods are useful in Programming in General. Provide Examples.

Explain how methods are useful in Programming in General. Provide Examples.

Homework Answers

Answer #1
  1. n Programming methods are helpfull to write the resuable code like we can write the code once and call any number of times
  2. Methods makes programmer life is easy to main as we can change at one place so that it will fixed all places where it is being used
  3. Methods makes programs more readable as it is written in separate block

Example:

using System;
class HelloWorld {
  static void Main() {
    Console.WriteLine(sum(10,2));
    Console.WriteLine(sum(10,4));
    Console.WriteLine(sum(100,212));
    
  }
  static int sum(int a,int b){
      return a+b;
  }
}

In the above code I have created a sum method and using it 3 times in main method

NOTE : PLEASE COMMENT BELOW IF YOU HAVE CONCERNS.

Please Like and Support me as it helps me a lot

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Forecasting Exchange Rates Explain two of the methods for forecasting exchange rates and provide examples of...
Forecasting Exchange Rates Explain two of the methods for forecasting exchange rates and provide examples of how they might work.
Explain the mechanism of allosteric regulation and provide examples how this mechanism can be used to...
Explain the mechanism of allosteric regulation and provide examples how this mechanism can be used to tune the flow of molecules in a metabolic pathway.
How can a week negative culture rode competitive advantages? Explain and provide examples.
How can a week negative culture rode competitive advantages? Explain and provide examples.
Explain how to develop a plan to leverage Stakeholder diversity, Provide Real world examples
Explain how to develop a plan to leverage Stakeholder diversity, Provide Real world examples
In C++ what are the searching methods? Please explain and give some examples.
In C++ what are the searching methods? Please explain and give some examples.
Explain the concept of Service Technology and provide examples.
Explain the concept of Service Technology and provide examples.
Why is linear programming useful in CPM crashing? Be detailed.
Why is linear programming useful in CPM crashing? Be detailed.
Explain the concept of Globalization Strategy and provide real examples.
Explain the concept of Globalization Strategy and provide real examples.
Explain, how religions separate people. Based on your own observation and research provide two examples of...
Explain, how religions separate people. Based on your own observation and research provide two examples of religious practice that separates people in United States
- Explain the methods that can estimate bad debt expenses in business. (Give numerical examples)
- Explain the methods that can estimate bad debt expenses in business. (Give numerical examples)