C Language Travel Agency Manager Exercise.
#include <stdio.h>
struct driver
{
char name[45];
char dlNo[50];
char route[47];
int kms;
};
int main()
{
struct driver d1, d2, d3;
printf("Enter the details of drivers no.1\n");
printf("Enter the name of first drivers\n");
scanf("%s", &d1.name);
printf("Enter the dlNo of first drivers\n");
scanf("%s", &d1.dlNo);
printf("Enter the route of first drivers\n");
scanf("%s", &d1.route);
printf("Enter the number of kms of first drivers\n");
scanf("%d", &d1.kms);
printf("Enter the details of drivers no.2\n");
printf("Enter the name of second drivers\n");
scanf("%s", &d2.name);
printf("Enter the dlNo of second drivers\n");
scanf("%s", &d2.dlNo);
printf("Enter the route of second drivers\n");
scanf("%s", &d2.route);
printf("Enter the number of kms of second drivers\n");
scanf("%d", &d2.kms);
printf("Enter the details of drivers no.3\n");
printf("Enter the name of third drivers\n");
scanf("%s", &d3.name);
printf("Enter the dlNo of third drivers\n");
scanf("%s", &d3.dlNo);
printf("Enter the route of third drivers\n");
scanf("%s", &d3.route);
printf("Enter the number of kms of third drivers\n");
scanf("%d", &d3.kms);
printf("*************Printing Information of these drivers:*************\n");
printf("for Driver No.1:\n Name is %s\n", d1.name);
printf("DL No. is %s\n", d1.dlNo);
printf("route is %s\n", d1.route);
printf("kms is %d\n", d1.kms);
printf("for Driver No.2:\n Name is %s\n", d2.name);
printf("DL No. is %s\n", d2.dlNo);
printf("route is %s\n", d2.route);
printf("kms is %d\n", d2.kms);
printf("for Driver No.3:\n Name is %s\n", d3.name);
printf("DL No. is %s\n", d3.dlNo);
printf("route is %s\n", d3.route);
printf("kms is %d\n", d3.kms);
return 0;
}
OUTPUT:
Enter the details of drivers no.1
Enter the name of first drivers
ram
Enter the dlNo of first drivers
567
Enter the route of first drivers
67894369
Enter the number of kms of first drivers
78
Enter the details of drivers no.2
Enter the name of second drivers
Ramesh
Enter the dlNo of second drivers
67893
Enter the route of second drivers
2treaq34
Enter the number of kms of second drivers
89
Enter the details of drivers no.3
Enter the name of third drivers
Rohan
Enter the dlNo of third drivers
89572
Enter the route of third drivers
hg8y9ty
Enter the number of kms of third drivers
46
*************Printing Information of these drivers:*************
for Driver No.1:
Name is ram
DL No. is 567
route is 67894369
kms is 78
for Driver No.2:
Name is Ramesh
DL No. is 67893
route is 2treaq34
kms is 89
for Driver No.3:
Name is Rohan
DL No. is 89572
route is hg8y9ty
kms is 46
Tysm
ReplyDeleteCC
ReplyDeleteMade my task easy
ReplyDelete