Monday 7 May 2018

Learn C language Part -41 Type Casting in C language





#include <stdio.h>

#include <conio.h>



main()

{



float a=(float) 9/2;

float x=3.142;

int y=x;

printf("%d",y);

//printf("%f",a);



}

jagged Array in C#







using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;



namespace ConsoleApplication8

{

    class Program

    {

        static void Main(string[] args)

        {

            int [][]jagged=new int[3][];

            jagged[0]=new int[]{11,22,33,44,55,66};

            jagged[1] = new int[] { 12, 24, 36, 48 };

            jagged[2] = new int[] { 13, 26, 39 };





            for (int i = 0; i < jagged.Length ; i++)

            {



                for (int j = 0; j < jagged[i].Length; j++)

                {

                    Console.Write(jagged[i][j]+"\t");

                }

                Console.WriteLine();



            }

            Console.ReadLine();



        }

    }

}


Multi Dimensional Array in C# Matrices sum,Print









using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;



namespace ConsoleApplication6

{

    class Program

    {



        public void InputMatrix(ref int[,]a)

        {



            for (int i = 0; i < 3; i++) //row

            {



                for (int j = 0; j < 3; j++) //column

                {

                    Console.Write("Enter the Number at index X[{0},{1}] = ", i, j);

                    a[i, j] = int.Parse(Console.ReadLine());

                    Console.WriteLine();

                }



            }



        }









        public void printMatrix(int [,]a)

        {

            for (int i = 0; i < 3; i++) //row

            {



                for (int j = 0; j < 3; j++) //column

                {

                    Console.Write(a[i, j] + "\t");

                }



                Console.WriteLine();

            }



        }







        public int[,] sum(int[,] a, int[,]b)

        {

            int[,] c = new int[3, 3];



            for (int i = 0; i < 3; i++)

            {

                for (int j = 0; j < 3; j++)

                {



                    c[i, j] = a[i, j] + b[i, j];

                }





            }





            return c;

        }



        static void Main(string[] args)

        {

            Program p = new Program();

            int[,] x = new int[3, 3];

            int[,] y = new int[3, 3];

            int[,] z = new int[3, 3];

           

            p.InputMatrix(ref x);

            Console.WriteLine("\n---------------------Matrix A---------------\n");

            p.printMatrix(x);

            p.InputMatrix(ref y);



            Console.WriteLine("\n---------------------Matrix B---------------\n");

            p.printMatrix(y);



            z = p.sum(x,y);

            Console.WriteLine("\n---------------------Matrix C ---------------\n");

            p.printMatrix(z);

       



            Console.ReadLine();

         





        }

    }

}


Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC

Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...