FUNCTION PARAMETER / /USER INPUT PARAMETER/ FUNCTION WITH IN A FUNCTION CONCEPT/

 FUNCTION PARAMETER:-


-parameter is special type of variable used in function().

-there are some types of parameter used in function().


1) receiver parameter-(at the time of function creation)

2) sender parameter -(at the time of function calling (access))



1) receiver parameter-



using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;


namespace FUNCTIONPARAMETER

{

    class Program

    {

        void input(int a)//receiver parameter 

        {

            Console.WriteLine(a);

           


        }

        static void Main(string[] args)

        {

            Program p1 = new Program();

            p1.input(20);//sender parameter

            Console.ReadKey();


        }

    }

}



USER INPUT PARAMETER:-


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;


namespace USERINPUTPARAMETER

{

    class Program

    {

        void input(int n)

        {

            Console.WriteLine(n);



        }


        static void Main(string[] args)

        {

            Program p1 = new Program();

            int a;

            Console.WriteLine("Enter any number");

            a = int.Parse(Console.ReadLine());

            p1.input(a);

            Console.ReadKey();


        }

    }

}



 FUNCTION WITH IN A FUNCTION CONCEPT:-


-in this concept user can access one function to other function.


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;


namespace FUNCTIONWITHNFUNCTION

{

    class Program

    {

        void display()

        {

            Console.WriteLine("Nagpur");


            show();


        }


        void show()

        {

            Console.WriteLine("Pune");


        }


        static void Main(string[] args)

        {

            Program p1 = new Program();

            p1.display();

            Console.ReadKey(); 


        }

    }

}


assignment 1:-


write a program to generate following result.

create a function- input()

create a parameter - roll, name, city, m1,m2,m3,m4,m5

logic:-

1) all parameter given by the user.

2)calculate total if all mark > 40

3) check the condition 

total> 250 - A grade

total >150< 250 - B grade

otherwise fail. 


Assignment 2:-


create a your own ideas using function parameter 







Comments

Popular posts from this blog

HTML FORMS

condition management IF, ELSE, ELSEIF

HTML NOTES