#include <stdio.h> 
#define MAX 10
 
void getgraph();      
void printgraph();   
int G[MAX][MAX];   
int n;                    
int main()
{ 
    
    scanf("%d",&n);
    getgraph(); 
    printgraph();
}

void getgraph()
{ 
    int i,j; 
    for(i=0;i<n;i++)
    {
        for(j=0;j<n;j++)
        scanf("%d",&G[i][j]);
    }
}
void printgraph()
{
    int i,j;
    printf("\nADJACENCY MATRIX OF GRAPH G");
    for(i=0;i<n;i++)
    {
        printf("\nVERTEX %d : ",i); 
        for(j=0;j<n;j++)
        {
            printf("%d ",G[i][j]);            
        }        
    }
}


Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: