Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int num_of_nodes;
- printf("Enter the Number of NODE: " );
- scanf("%d",&num_of_nodes);
- int i,j,graph[50][50];
- for(i=0;i<num_of_nodes;i++)
- {
- for(j=0;j<num_of_nodes;j++)
- {
- if(i!=j)
- {
- int num=rand()%2;
- graph[i][j]=num;
- }
- else
- {
- graph[i][j]=0;
- }
- }
- }
- for ( i=0;i<num_of_nodes;i++)
- {
- for (j=0;j<num_of_nodes;j++)
- {
- printf("%d ",graph[i][j]);
- }
- printf("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment