Write a C# program to create a user define function with parameter


Introduction

I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability..


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. using System;
  2.  
  3. public class functionexcercise
  4. {
  5. public static void welcome(string name)
  6. {
  7. Console.WriteLine("Welcome " + name );
  8. }
  9. public static void HaveAnice()
  10. {
  11. Console.WriteLine("Have a nice day");
  12. }
  13. public static void Main(string[] args)
  14. {
  15. string str1;
  16. Console.Write("Please Enter a name : ");
  17. str1 = Console.ReadLine();
  18. welcome(str1);
  19. HaveAnice();
  20.  
  21. Console.ReadLine();
  22. }
  23. }

Result

C# language techstudy

     





Related Topics




Popular Posts