Sunday, April 24, 2016

WRITE A C PROGRAM TO IMPLEMENT LINK STATE ROUTING.



#include<stdio.h>
#include<conio.h>
void main()
{
int n,a[10][10],i,j,k;
clrscr();
printf("\n Enter the no of nodes :");
scanf("%d",&n);
printf("Enter the matrix elements:");
for(i=0;i<n;i++)
{
printf("\n Enter Distance");
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
}
for(i=0;i<n;i++)
{
printf("The LINK STATE %d \n");
for(j=0;j<n;j++)
{
if(a[i][j]!=0 && a[i][j]!=-1)
{
printf("%d \t %d \n",j+1,a[i][j]);
}
}
printf("\n\n");
}
getch();
}

No comments:

Post a Comment