Question
Hi, we just started learning functions for C# console app in my class & im having a hard time understanding the concept, These are the
Hi, we just started learning functions for C# console app in my class & im having a hard time understanding the concept, These are the example questions we've been given, if anyone could assist that would be great! For each sub part below you must create a main program to test it. Write a program with a function that takes two integer parameters, adds them together, then returns the sum. The program should ask the user for two numbers, then call the function with the numbers as arguments, and tell the user the sum. Write a function that takes 2 numbers ( double values) and returns the larger of the two numbers. Write a function called compNumbers that takes 2 numbers (double values). If the two numbers are the same it returns 0. If the first parameter is larger than the second, it returns 1. If the second parameter is larger than the first it should return -1. Write a function calculateAverage that takes 5 numbers (double values) and returns the average of the 5 numbers. To calculate the average, you add all the numbers up and divide the result by 5. Write a function isPrime that takes an integer and returns true if the parameter is prime and false otherwise.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started