0% found this document useful (0 votes)
44 views

Function Exercises

The document provides 12 prompts for writing C# programs to create various user-defined functions, including functions to: sum two numbers, count spaces in a string, calculate the sum of elements in an array, swap integer values, raise a number to a power, display a Fibonacci sequence, check if a number is prime, calculate the sum of digits in a number, find the factorial of a number recursively, and calculate a Fibonacci number of a specific term recursively.

Uploaded by

Monti Saini
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Function Exercises

The document provides 12 prompts for writing C# programs to create various user-defined functions, including functions to: sum two numbers, count spaces in a string, calculate the sum of elements in an array, swap integer values, raise a number to a power, display a Fibonacci sequence, check if a number is prime, calculate the sum of digits in a number, find the factorial of a number recursively, and calculate a Fibonacci number of a specific term recursively.

Uploaded by

Monti Saini
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

 Write a program in C# Sharp to create a user define function. 


2. Write a program in C# Sharp to create a user define function with parameters. 

3. Write a program in C# Sharp to create a function for the sum of two numbers. 

4. Write a program in C# Sharp to create a function to input a string and count


number of spaces are in the string. 

5. Write a program in C# Sharp to calculate the sum of elements in an array.

6. Write a program in C# Sharp to create a function to swap the values of two


integer numbers.

7. Write a program in C# Sharp to create a function to calculate the result of


raising an integer number to another.

8. Write a program in C# Sharp to create a function to display the n number


Fibonacci sequence. 

9. Write a program in C# Sharp to create a function to check whether a number is


prime or not. 

10. Write a program in C# Sharp to create a function to calculate the sum of the


individual digits of a given number. 

11. Write a program in C# Sharp to create a recursive function to find the factorial


of a given number.

12. Write a program in C# Sharp to create a recursive function to calculate the


Fibonacci number of a specific term.

You might also like