top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Code to find the string in 2 dimentional array

+1 vote

How to Write a code to find the string in 2 dimentional array?

posted Mar 28, 2014 by Khusboo

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button
Your Question is not complete. Can you explain further????
Please explain how the string should be find in the 2-d array........I mean to say that what are the constraints...
Also Do u want the code or Approach to solve this problem.

1 Answer

0 votes
Best answer
using System;

namespace ArrayApplication
    class MyArray
        static void Main(string[] args)
            /* an array with 5 rows and 2 columns*/
            int[,] a = new int[5, 2] {{0,0}, {1,2}, {2,4}, {3,6}, {4,8} };

            int i, j;

            /* output each array element's value */
            for (i = 0; i < 5; i++)
                for (j = 0; j < 2; j++)
                    Console.WriteLine("a[{0},{1}] = {2}", i, j, a[i,j]);

When the above code is compiled and executed, it produces the following result:

a[0,0]: 0
a[0,1]: 0
a[1,0]: 1
a[1,1]: 2
a[2,0]: 2
a[2,1]: 4
a[3,0]: 3
a[3,1]: 6
a[4,0]: 4
a[4,1]: 8
answer Dec 1, 2014 by Shivaranjini
Similar Questions
+4 votes

Also want to know where and how each one is used?

+3 votes

What is the difference between VB script and java script?

+2 votes

Develop a C# Windows Form Application that allows users to do all of the following.
Read a List of patient's information from a text file (*.txt), the input text file is selected from the Open File Dialog.
Your program should accept any text file with the following format:
a. The file contains columns with Basic information about patients.
b. Columns may be separated by spaces and/or tabs.
c. The first line in the file is the column header.
d. After the header, each line represents a Patient (name, address, phone#, Bdate, gander ,wheight, height and blood type).
e. Successfully imported patients are displayed on a data grid view in a second form and added to a patient list.

  1. The user will be able to display on The Grid view :
    a) Female patients.
    b) Patients with age<45 year. c) Save Over weighted patients on a text file .  Note: To find over weighted patients you have to calculate the BMI value. BMI=Weight/ (Height*Height). If BMI <18.5 >>>>> under weighted.
    18.5<=BMI<=25 >>>>>>>Normal.
    BMI>25 >>>>>>>>>>>> Over Weighted.
Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.