0

This is a practice program for taking input of the names , license numbers , route of travel , and the number of kilometers travelled with the company .

In this upon execution the program skips the the one or the other inputs based on whether i use gets() function or scanf() function .

If any error please tell .

#include<stdio.h>
#include<string.h>
struct driver
{
    char drivername[500];
    int license;
    char route[500];
    int kilometers;
};

int main()
{
    struct driver Driver1, Driver2, Driver3 ; 

    printf("Driver 1 enter your details\n");
    printf("Enter your name \n");
    gets(Driver1.drivername);
    
    printf("Enter your license number \n");
    scanf("%d", &Driver1.license);

    printf("Enter the route on which you travel on \n");
    gets(Driver1.route);

    printf("Enter the number of kilometers travelled with the compmany \n");
    scanf("%d" , &Driver1.kilometers);

    printf("%s" , Driver1.route);
    printf("%s" , Driver1.drivername);


    return 0;
}
Barmar
  • 741,623
  • 53
  • 500
  • 612
Chetxn04
  • 43
  • 2

0 Answers0