Distance Vector Routing Program in C
Distance Vector Routing Program in C
#include<stdio.h>
int dist[50][50],temp[50][50],n,i,j,k,x;
void dvr();
int main()
scanf("%d",&n);
for(i=0;i<n;i++)
for(j=0;j<n;j++)
scanf("%d",&dist[i][j]);
dist[i][i]=0;
temp[i][j]=j;
printf("\n");
dvr();
scanf("%d",&i);
scanf("%d",&j);
printf("enter the new cost");
scanf("%d",&x);
dist[i][j]=x;
printf("After update\n\n");
dvr();
return 0;
void dvr()
temp[i][j] = k;
for(i=0;i<n;i++)
for(j=0;j<n;j++)
printf("\n\n");
}
OUTPUT:
20
0
18
4
15
8
0
32
41
24
51
0