google.com, pub-4617457846989927, DIRECT, f08c47fec0942fa0 Learn to enjoy every minute of your life.Only I can change my life.: C program for 2-D array

Wednesday, April 1, 2015

C program for 2-D array

Write a ‘C’ program to accept ‘n’ names from user store these name into
2-D array. Accept the name from user and search whether the name is
present in an array or not.

#include<stdio.h>
#include<conio.h>
void main()
{
char name[5][10],res[10];
int i,j,n;
clrscr();
printf("enter the no");
scanf("%d",&n);
printf("enter the matrix element");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
scanf("%s",&name[i][j]);
}
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
printf("enter the name");
scanf("%s",&res);
if(strcmp(&name[i][j],&res)!=0)
{
printf("name is not found");
break;
}
else
{
printf("name is found");
}
}
}
getch();
}

शिव भोलेनाथ स्तुति

 जय शिवशंकर, जय गंगाधर, करुणा-कर करतार हरे,   जय कैलाशी, जय अविनाशी, सुखराशि, सुख-सार हरे जय शशि-शेखर, जय डमरू-धर जय-जय प्रेमागार हरे,   जय ...