answersLogoWhite

0


Best Answer

#include<stdio.h>

int main()

{

int n,i,j,k,a[10][10];

printf("\nEnter the number of nodes: ");

scanf("%d",&n);

for(i=0; i<n; i++)

{

for(j=0; j<n; j++)

{

printf("\nEnter the distance between the host %d%d:", i+1,j+1);

scanf("%d",&a[i][j]);

}

}

for(i=0; i<n; i++)

{

for(j=0; j<n; j++)

printf("%d\t",a[i][j]);

printf("\n");

}

for(k=0; k<n; k++)

{

for(i=0; i<n; i++)

{

for(j=0; j<n; j++)

{

if(a[i][j]>a[i][k]+a[k][j])

a[i][j]=a[i][k]+a[k][j];

}

}

}

for(i=0; i<n; i++)

{

for(j=0; j<n; j++)

{

b[i][j]=a[i][j];

if(i==j)

b[i][j]=0;

}

}

printf("\nThe output matrix is:\n");

for(i=0;i<n;i++)

{

for(j=0;j<n;j++)

printf("%d\t",b[i][j]);

printf("\n");

}

return 0;

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
User Avatar

Anderson Bueguem

Lvl 1
3y ago
What the?

Add your answer:

Earn +20 pts
Q: Distance vector routing in c program?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

If vector c equals vector a plus vector b under what circumstances does c equal a minus b?

When b is zero.


What is flat routing protocol of DSDV?

Destination-Sequenced Distance-Vector Routing (DSDV) is a table-driven routing scheme for ad hoc mobile networks based on the Bellman-Ford algorithm. It was developed by C. Perkins and P.Bhagwat in 1994. The main contribution of the algorithm was to solve the routing loop problem. Each entry in the routing table contains a sequence number, the sequence numbers are generally even if a link is present; else, an odd number is used. The number is generated by the destination, and the emitter needs to send out the next update with this number. Routing information is distributed between nodes by sending full dumps infrequently and smaller incremental updates more frequently.


What statement describes a route that has been learned dynamically?

Full question is: What describes a route learned dynamically It is A identified by the prefix C in the routing table B automatically updated and maintained by routing protocols C unaffected by changes in the topology of the network D an administrative distance of 1 Answer: It is automatically updated and maintained by routing protocols.


If vector A has a magnitude of 14 meters and vector B has a magnitude of 6 meters Vector C equals A-B The magnitude of C cannot be?

The magnitude of C cannot be &gt;20.


If vector A is perpendicular to vector B and C then Vector A is parallel to?

Vector A is parallel to the cross product of vectors B and C, and it is parallel to the axis that neither B or C lie along if the two other axes are defined as the axes that B and C lie along.


How do you write a c plus plus program to sort a vector of strings using MSD radix sort?

The standard library sort algorithm automatically uses MSD radix to sort strings: std::vector&lt;std::string&gt; vs = {"a", "b", "c" "d", "ab"}; std::sort(vs.begin(), vs.end()); After sorting, the order will be: {"a", "ab", "b", "c", "d"}


What has the author C D Collinson written?

C. D. Collinson has written: 'Introductory vector analysis' -- subject(s): Vector analysis


What is the vector of hepatitis?

Hepatitis A, B or C?


Two or more velocities can be combined by?

Velocity is a vector quantity(it has a direction). Simply use the vector adding method to combine velocities.


The figure shows two vector B and C along with magnitude and direction . D is given by D =B -C. What is the magnitude of vector of D What angle does vector D make with the +x-axis?

Nothing


What do the 'c' and 'v' in argc and argv stand for?

c for count v for vector


How to find the direction of vector A by its x and y components?

Consider any two points on the vector, P = (a, b) and Q = (c, d). And lext x be the angle made by the vector with the positive direction of the x-axis. Then either a = c, so that the vector is vertical and its direction is straight up or a - c is non-zero. In that case, tan(x) = (b - d)/(a - c) or x = tan-1[(b - d)/(a - c)]