Solution:
#include<stdio.h>
#include<conio.h>
void main()
{
int i,aa,data[10]={0},ele,j;
clrscr();
a:
printf("Enter an Element::");
scanf("%d",&ele);
j=ele%10;
c:
if(data[j]==0)
{
data[j]=ele;
}
else
{
j=j+1;
goto c;
}
printf("\n1:insert 2:display\nEnter choise::");
scanf("%d",&aa);
switch(aa)
{
case 1:goto a;
default:goto b;
}
b:
printf("\nHash table\n");
for(i=0;i<10;i++)
{
printf("%d %d\n",i,data[i]);
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int i,aa,data[10]={0},ele,j;
clrscr();
a:
printf("Enter an Element::");
scanf("%d",&ele);
j=ele%10;
c:
if(data[j]==0)
{
data[j]=ele;
}
else
{
j=j+1;
goto c;
}
printf("\n1:insert 2:display\nEnter choise::");
scanf("%d",&aa);
switch(aa)
{
case 1:goto a;
default:goto b;
}
b:
printf("\nHash table\n");
for(i=0;i<10;i++)
{
printf("%d %d\n",i,data[i]);
}
getch();
}
Comments
Post a Comment
Thank you