# Untitled

unknown
plain_text
2 years ago
1.7 kB
4
Indexable
Never
```#include<stdio.h>
#include<time.h>
#include<math.h>
#include<stdlib.h>
#define max 9001

int main()
{
int i, j, n,deg=0,edge=0,sum=0;
double total_time;
clock_t start,end;

printf("Number of Vertices : ");
scanf("%d",&n);

srand(time(0));
start=clock();
for(i=0;i<n;i++){
for(j=0;j<n;j++){
}
}
else if(i==j){
}
}
}
for(i=0; i<n; i++){
for(j=0; j<n; j++){
}
printf("\n");
}
printf("\n Vertices \t Degree ");
for ( i = 0 ; i < n ; i++ ){
deg = 0;
for ( j = 0 ; j < n ; j++ )
deg++;
printf("\n\n %5d \t\t %d\n\n", i, deg);
}

for(i=0;i<n;i++){
deg=0;
for(j=0;j<n;j++){
deg++;
}
edge++;
}
}
sum+=deg;
}
printf("\n\n The Number of Total Degrees is: %d\n",sum);

printf("\n\n The Number of Total Edges is: %d\n",edge);

printf("\n\n The Number of Edges is=(Summation of Degree/2)=(%d/2)=%d" ,sum,sum/2);

printf("\n\n Therefore Handshaking Theorem is Proved\n\n");

end=clock();
total_time=((double)(end-start)/CLOCKS_PER_SEC)*pow(10,9);

printf("\n  Execution time : %1f ns \n",total_time);
printf("\n");
return 0;
}
```