Vous êtes sur la page 1sur 3

# Program; Experiment 2.4 #include<stdio.h> #include<conio.

h> Algorithm;
1. 2. 3. 4.

main() { int x,y,z; Input call destination code printf("Legend: \n"); printf("\nCode - Off-Peak Hours - Rate/Min"); Input the time code. printf("\tCode - Peak Hours - Rate/Min"); Multiply the call destination code, to the printf("\n1 - Calls to the same network - P8"); printf("\t1 - Calls to the same network - P3"); time code. printf("\n2 - Call to other network - P8"); Diplay the duration of call and the total cost printf("\t\t2 - Call to other network - P4"); charges. printf("\n3 - Call to a landline - P8"); printf("\t\t3 - Call to a landline - P4"); printf("\n4 - National direct dial - P11"); printf("\t\t4 - National direct dial - P7"); printf("\n5 - Internationa direct dial - P20"); printf("\t5 - Internationa direct dial - P20"); printf("\n\nCall Destination Code(1=Off-Peak, 2=Peak): "); scanf("%d", &x); printf("\nTime Code: "); scanf("%d", &y); printf("\nDuration of Call: "); scanf("%d", &z); printf("\n"); if((x==1) &&(y==1)) printf("The total cost charges is P%d", 8*z); if((x==2) &&(y==1)) printf("The total cost charges is P%d", 8*z); if((x==3) &&(y==1)) printf("The total cost charges is P%d", 8*z); if((x==4) &&(y==1)) printf("The total cost charges is P%d", 11*z); if((x==5) &&(y==1)) printf("The total cost charges is P%d", 20*z); if((x==1) &&(y==2)) printf("The total cost charges is P%d", 3*z); if((x==2) &&(y==2))

printf("The total cost charges is P%d", 4*z); if((x==3) &&(y==2)) printf("The total cost charges is P%d", 4*z); if((x==4) &&(y==2)) printf("The total cost charges is P%d", 7*z); if((x==5) &&(y==2)) printf("The total cost charges is P%d", 20*z); getch(); } A

Y If x=1 y=1 N If x=2 y=1 N If x=3 y=1 N Y If x=4 y=1 N Y 1=off peak hours 2=peak hours If x=5 y=1 N PrintTime Code If x=1 y=2 N PrintDuration Of Call Y If x=2 y=2 The total cost of charges Is P%d Y The total cost of charges Is P%d The total cost of charges Is P%d The total cost of charges Is P%d Y The total cost of charges Is P%d Y The total cost of charges Is P%d The total cost of charges Is P%d

Flowchart; START

Legend; Off-Peak Hours - Rate/Min Peak Hours - Rate/Min Calls to the same network - P8 Calls to the s ame network - P3 Call to other network - P8 Call to other network - P4 Call to a landline - P8 Call to a landline - P4 National direct dial - P11 National direct dial - P7 Internationa direct dial - P20 Internationa direct dial - P20

If x=3 y=2 N

## The total cost of charges Is P%d

Y If x=4 y=2 N Y If x=5 y=2 N END The total cost of charges Is P%d The total cost of charges Is P%d