#include<stdio.h> #include<conio.h> // *************** variable declaration ***************// static int job_machine
; //to store jobs time for machines float job_prob
; // to tore jobs probability for machine float exp_pro_time
4
; // to store expacted processing time float m1m2
5
4
,m2m3
,m3m4
; float k2,k3,k4; float h1,h2,h3,h4; // ************** end variable declaration **************// void get_job_machine() //function to get jobs time and probabiity for machine {int i,j;/* int arr
5
4
={10,40,5,20,25,30,20,40, 20,20,20,10, 30,5,25,40, 20,30,20,20}; float arr2
5
4
={0.2,0.1,0.2,0.4,0.2,0.1,0.2,0.1, 0.1,0.3,0.2,0.3, 0.3,0.4,0.2,0.1, 0.2,0.1,0.2,0.1, }; for(i=0;i<5;i++) { for(j=0;j<4;j++) { job_machine
i
j
=arr
i
j
; job_prob
i
j
=arr2
i
j
;} }
*/printf(“∖ nEnter 5 Jobs Time & Probability for 4 Machines: "); for (i=0;i<5;i++ ){for(j=0;j<4;j++){printf(“∖ n∖ n Enter Job
%d
Time for Machine
%d
: ",i+1,j+1);scanf(“%d”,&job_machine
i
j
); printf(“∖ n∖ n Enter Job
%d
Probability for Machine
%d
: ",i+1,j+1); scanf(“%f",&job_prob
i
j
);
// end of get_job_marchine function// void put_job_machine() //function to show jobs time and probabiity for machine {int i,j; printf(“∖ n∖ t Machine1∖ t Machine2∖ t Machine3∖ t Machine4∖ n"); printf(“∖ nJobs∖ tTime∖ tProb.∖ tTime∖ tProb.∖ tTime∖ tProb.∖ tTime∖ tProb."); for(i=0;i<5;i++) {printf(“∖ n∖ n
%d
",i+1); for(j=0;j<4;j++){printf(“∖ t%d∖ t%.1f",job_machine
i
j
,job_prob
i
j
);
// end of Put_job_marchine function// void get_exp_pro_time() // function to calculatig expected processing time {int i,j;for(i=0;i<5;i++) {for(j=0;j<4;j++){exp_pro_time
i
j
=job_machine
i
j
*job_prob
i
j
;
// end of get_exp_pro_time function// void put_exp_pro_time() // function to showing expected processing time {int i,j; printf(“
n∖ nExpected Proessing Time: -"); printf(“
n
nJobs
t Machine1∖ t Machine2
t Machine3
t Machine4
n");for(i=0;i<5;i++) {printf(“
n
n
%d
",i+1);for(j=0;j<4;j++) {printf(“∖ t∖ t%.1f",exp_pro_time
i
j
);
// end of Put_exp_pro_time function// void get_in_out_table() // function to calculating In Out Table for maching {int i;float p1,p2;// Machine m1-m2p1=0.0;p2=0.0;for(i=0;i<5;i++) {m1m2
i
0
=p1;m1m2
i
1
=exp_pro_time
i
0
+p1;p1=m1m2
i
1
; if(p2>p1)m1m2
i
2
=p2;elsem1m2
i
2
=p1; m1m2
i
3
=m1m2
i
2
+exp_pro_time
i
1
;p2=m1m2
i
3
;} // Machine m2-m3p1=0.0;p2=0.0;for(i=0;i<5;i++) {m2m3
i
0
=p1;m2m3
i
1
=exp_pro_time
i
1
+p1; p1=m2m3
i
1
;if(p2>p1)m2m3
i
2
=p2; elsem2m3
i
2
=p1;m2m3
i
3
=m2m3
i
2
+exp_pro_time
i
2
; p2=m2m3
i
3
;} // Machine m3-m4p1=0.0;p2=0.0;for(i=0;i<5;i++) {m3m4
i
0
=p1;m3m4
i
1
=exp_pro_time
i
2
+p1; p1=m3m4
i
1
;if(p2>p1)m3m4
i
2
=p2; elsem3m4
i
2
=p1;m3m4
i
3
=m3m4
i
2
+exp_pro_time
i
3
; p2=m3m4
i
3
;
// end of get_in_out_table function// void put_in_out_table() // function to showing In Out Table for maching {int i,j; printf(“∖ n∖ nIn-Out Table: -"); printf(“∖ n∖ nJobs M1-M2 M2-M3 M3-M4∖ n"); for(i=0;i<5;i++) {printf(“∖ n∖ n%d ",i+1);for(j=0;j<4;j++) {if(j==1
j==3) printf(“-");else printf(“ "); printf(“%4.1f",m1m2
i
j
);if(j==3) printf(“ %c",179);} for(j=0;j<4;j++) {if(j==1
j==3) printf(“-");else printf(“ "); printf(“%4.1f",m2m3
i
j
);if(j==3) printf(“ %c",179);}for(j=0;j<4;j++) {if(j==1
j==3) printf(“-");else printf(“ "); printf(“%4.1f",m3m4
i
j
);if(j==3) printf(“ %c",179);
// end of Put_in_out_table function// void final() {int i;float sum=0.0;for(i=0;i<5;i++)sum=sum+exp_pro_time
i
1
; k2=m1m2
4
3
-sum;sum=0.0; for(i=0;i<5;i++)sum=sum+exp_pro_time
i
2
;k3=m2m3
4
3
-sum; sum=0;for(i=0;i<5;i++)sum=sum+exp_pro_time
i
3
;k4=m3m4
4
3
-sum; h1=0;h2=k2;h3=h2+k3;h4=h3+k4; printf(“∖ n∖ nK2∖ tK3∖ tK4∖ tH1∖ tH2∖ tH3∖ tH4"); printf(“∖ n∖ n%.1f∖ t%.1f∖ t%.1f∖ t%.1f∖ t%.1f∖ t%.1f∖ t%.1f",k2,k3,k4,h1,h2,h3,h4);} void main() {clrscr();getch();get_job_machine();put_job_machine();getch(); get_exp_pro_time();put_exp_pro_time();getch();get_in_out_table(); put_in_out_table();getch();final();getch();}