## Pages

### Data Structures Warshall's Algorithm C Program

This program is for Warshall's Algorithm in C, and is a part of Mumbai University MCA Colleges Data Structures in C program MCA Sem 2

#include<stdio.h>
#include<conio.h>
#define MAX 20
main()
{
int i,j,k,n;
clrscr();
printf("==================== WARSHALL'S ALGORITHM ===================\n");
printf("\nEnter number of vertices : ");
scanf("%d",&n);
for(i=0;i<n;i++)
for(j=0;j<n;j++)

printf("\nThe weighted adjacency matrix is :\n");
for(i=0;i<n;i++)
for(j=0;j<n;j++)
else

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

for(k=0;k<n;k++)
{
printf("\nP%d is :\n",k);
display(path,n);
for(i=0;i<n;i++)
for(j=0;j<n;j++)
path[i][j]=( path[i][j] || ( path[i][k] && path[k][j] ) );
}
printf("Path matrix P%d of the given graph is :\n",k);
display(path,n);
getch();
}

display(int matrix[MAX][MAX],int n)
{
int i,j;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
printf("%3d",matrix[i][j]);
printf("\n");
}

}

Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.