I suspect that this is because you are tyring to print a standard int value with %ld, the formatting marker for long int. I you need values greater than 2 billion, then you need to declare the variables as long or even long long (depending) as well.

BTW, has this assignment been handed in yet? It's been over a week.

i got a week extension. Diwali breaks.... the program is complete, i have to change if the professor suggests any change... but its over... thanks a lot mates.... you helped a lot....

#include<stdio.h>
#include<conio.h>
int main()
{
    int u,d,r,l,nod;
    char name[100],phno[10];
    char city[100], vno[100];
    clrscr();
    printf("Name of the Customer : \n");
    scanf("%s", name);
    printf("Place of the Customer :\n");
    scanf("%s", city);
    printf("\n Enter the ph no :\n");
    scanf("%s", phno);
    printf("\n Enter the no of days : \n");
    scanf("%d", &nod);
    printf("\n Enter the hired Vehicle Reg No : \n");
    scanf("%s", &vno);

    clrscr();
    printf("\n CAR RENTAL APPLICATION \n");
    printf("\n ----------------------- \n");
    printf("\n Press 1 for Deluxe Vehicles \n");
    printf("\n Press 2 for Long or Road Trip Vehicles \n");
    printf("\n Press 3 for Luxury Vehicle \n");
    printf("\n ---------------------------- \n");
    printf("\n Press any Option: \n");
    scanf("%d", &u);
    switch(u)
    {
        case 1:
        printf("\n You have chosen Deluxe Vehicles \n");
        printf("\n Deluxe Vehicle Available are \n");
        printf("\n Maruti ZEN, OMNI, V.POLO \n");
        printf("\n ------------------------------ \n");
        printf("\n do u want to hire, Press 1 | ZEN, 2 | OMNI, 3 | POLO \n");
        scanf("%d", &d);
        clrscr();
        switch(d)
        {
            case 1:
            printf("\n You have selected ZEN | %drs per day \n ie total %dRs\n",1000, 1000*nod);
            break;

            case 2:
            printf("\n You have selected OMNI | %drs per day \n ie total %dRs\n",1500, 1500*nod);
            break;

            case 3:
            printf("\n You have selected Volkswagen Polo | %drs per day \n ie total %dRs\n",1700, 1700*nod);
            break;
        }
        break;

        case 2:
        printf("\n You have chosen Long Trip Vehicles \n");
        printf("\n Vehicles Available are \n");
        printf("\n TATA SUMO, TAVERA, TOOFAN \n");
        printf("\n ----------------------------- \n");
        printf("\n do u want to hire , press 1 | TATA, 2 | TAVERA, 3 | TOOFAN \n");
        scanf("%d", &r);
        clrscr();
        switch (r)
        {
            case 1:
            printf("\n You have selected TATA SUMO | %drs per day \n ie total %dRs\n",2000, 2000*nod);
            break;

            case 2:
            printf("\n You have selected TAVERA 5| %drs per day \n ie total %d Rs\n",1900,1900*nod);
            break;

            case 3:
            printf("\n You have selected TOOFAN | %drs per day \n ie total %dRs\n",1500, 1500*nod);
            break;

        }
        break;

        case 3:
        printf("\n You have chosen Luxury Cars");
        printf("\n Luxury Vehicles Available are \n");
        printf("\n BENZ, BMW, AUDI \n");
        printf("\n ------------------------------ \n");
        printf("\n Do u want to hire, Press 1 | Benz, 2 | BMW, 3 | Audi \n");
        scanf("%d", &l);
        clrscr();
        switch(l)
        {
            case 1:
            printf("\n You have selected Benz | Cost %drs per day \n ie total %dRs\n",2500, 2500*nod);
            break;

            case 2:
            printf("\n You have selected BMW | %drs per day \n ie total %dRs\n",2000, 2000*nod);
            break;

            case 3:
            printf("\n You have selected Audi | %drs per day \n ie total %dRs\n",3000, 3000*nod);
            break;
        }
        break;
    }

    printf("The name of the customer is : %s \n",name);
    printf("Place of Hiring : %s \n",city);
    printf(" Contact number of the Customer is : %s \n",phno);
    printf("Number of days Vehicle is hired : %d \n",nod);
    printf(" Registeration number of the hired vehicle : %s \n",vno);
    getch();
    return 0;
}

For the record, I thought you might want to see the version of the program I came up with; you may find it Illuminating fnord as far as the techniques I used for it.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

const int total_categories = 3;
enum CATEGORY {DELUXE, SUV, LUXURY};
const char* category_name[] = {"Deluxe Vehicle", "Sport-Utility Vehicle", "Luxury Car"};
const int category_size[] = {3, 3, 3};

struct Car
{
    char make[16];
    char model[16];
    char year[6];
    int price;
};

const struct Car DELUXE_MODELS[] =
{
    {"Maruti", "Zen", "2011", 4000},
    {"Maruti", "Omni", "2012", 5000},
    {"Volkswagen", "Polo", "2011", 15000}
};

const struct Car SUV_MODELS[] =
{
    {"Tata", "Sumo", "2010", 9000},
    {"Chevrolet", "Tavera", "2009", 12000},
    {"Trax", "Toofan", "2011", 10000}
};

const struct Car LUXURY_MODELS[] =
{
    {"Mercedes", "E350 Sedan", "2012", 9000},
    {"BMW", "640i Convertible", "2012", 12000},
    {"Audi", "A5 Coupe", "2012", 10000}
};

const struct Car* MODEL_CLASSES[] = {DELUXE_MODELS, SUV_MODELS, LUXURY_MODELS};

struct Customer
{
    char name[32];
    int age, daysOfRental;
    char phone_number[16];
    char address[3][32];      /* three lines of 32 chars each */
    struct Car* vehicle;
};

/* function prototypes */
void printBanner();
void getCustomer(struct Customer* customer);
enum CATEGORY getType();
const struct Car* getCar(enum CATEGORY type);
void printReceipt(struct Customer* customer);
void strTrim(char* s);


int main()
{
    struct Customer customer;
    enum CATEGORY type;

    printBanner();
    getCustomer(&customer);
    type = getType();
    customer.vehicle = (struct Car*) getCar(type);
    printReceipt(&customer);

    return 0;
}

void printBanner()
{

    printf("\n CAR RENTAL APPLICATION \n");
    printf("\n ----------------------- \n");
}

void getCustomer(struct Customer* customer)
{
    char ndays[4], age[4];

    printf("\nEnter the number of days you want to rent the car: ");
    fgets(ndays, 4, stdin);
    sscanf(ndays, "%d", &(customer->daysOfRental));
    printf ("Enter Your Name: ");
    fgets(customer->name, 32, stdin);
    strTrim(customer->name);
    printf("Enter your age: ");
    fgets(age, 4, stdin);
    sscanf(age, "%d", &(customer->age));
    printf("Enter your phone number: ");
    fgets(customer->phone_number, 16, stdin);
    strTrim(customer->phone_number);
    printf("Enter your street address: ");
    fgets(customer->address[0], 32, stdin);
    strTrim(customer->address[0]);
    printf("Enter your unit or apartment: ");
    fgets(customer->address[1], 32, stdin);
    strTrim(customer->address[1]);
    printf("Enter your city and country or state/province: ");
    fgets(customer->address[2], 32, stdin);
    strTrim(customer->address[2]);
}

enum CATEGORY getType()
{
    char option[4];
    int i, car_type;

    do
    {
        for (i = 0; i < total_categories; i++ )
        {
            printf("\nPress %d for %ss \n", i + 1, category_name[i]);
        }

        printf("\n ---------------------------- \n");
        printf("\n Press any Option: \n");
        fgets(option, 4, stdin);
        sscanf(option, "%d", &car_type);
    }
    while ((car_type < 1) || (car_type > 3));

    return (enum CATEGORY) car_type - 1;
}

const struct Car* getCar(enum CATEGORY type)
{
    const struct Car* car_class = MODEL_CLASSES[type];
    const char* const type_name = category_name[type];
    char query[4];
    char model_number[4];
    int i, model;
    const int available_models  = category_size[type];

    do
    {
        printf("There are %d %ss to choose from: \n", available_models, type_name);
        printf("\nVehicles Available are \n");
        for (i = 0; i < available_models; i++)
        {
            printf("\t%d: %s %s\n", i + 1, car_class[i].make, car_class[i].model);
        }
        printf("\n\n ----------------------------- \n");
        printf("Enter the number of the car model you want: ");
        fgets(model_number, 4, stdin);
        printf("You entered: %s\n", model_number);
        sscanf(model_number, "%d", &model);
        model--;
        printf("\n You have selected %s %s %s | Cost %drs per day \n",
               car_class[model].year, car_class[model].make,
               car_class[model].model, car_class[model].price);
        printf("Is this correct?");
        fgets(query, 4, stdin);
    }
    while (toupper(query[0]) != 'Y');
    return &car_class[model];
}

void printReceipt(struct Customer* customer)
{
    printf("\n\n ----------------------------- \n");
    printf("\n\n Rental Agreement \n");
    printf("\n\n ----------------------------- \n");
    printf("\n\n\nI, %s, hereby agree to pay %drs for the rental of a\n",
           customer->name, customer->vehicle->price * customer->daysOfRental);
    printf("%s %s %s for a period of %d days.\n",
           customer->vehicle->year, customer->vehicle->make,
           customer->vehicle->model, customer->daysOfRental);
}

void strTrim(char* s)
{
    int i = 1;
    int len = strlen(s);

    while (isspace(s[len - i]))
    {
        s[len - i] = '\00';
        i++;
    }
}
#include <stdio.h>  //header
#include <stdlib.h>

int main()
{   //applicant information
    char name[30];
    char faculty[30];
    char matric_no[20];
    char date[10];
    char vehicle[20];
    char destination[50];
    char travelling_purpose[50];

    int time1, time2, number_passengers;
    int mobile_no, total_hours;

    printf("Please enter your name  : ");
    scanf("%s", &name);
    printf("\nPlease enter your faculty name  : ");
    scanf("%s", &faculty);
    printf("\nPlease enter your matric number : ");
    scanf("%s", &matric_no);
    printf("\nDate   : ");
    scanf("%s", &date);
    printf("\nPlease enter your mobile number   : ");
    scanf("%d", &mobile_no);

    //booking information




    printf("\nType of vehicle : ");
    scanf("%s", &vehicle);

    printf("\nBooking Date    : ");
    scanf("%s", &date);

    printf("\nBooking time (24hours) from  : ");
    scanf("%d", &time1);
    printf(" \t\t\tto   : ");
    scanf("%d", &time2);

    printf("\nDestination  : ");
    scanf("%s", &destination);

    printf("\nTravelling Purpose  :  ");
    scanf("%s", &travelling_purpose);

    printf("\nNumber of passengers    : ");
    scanf("%d", &number_passengers);

    total_hours= time2-time1 ;

    //printf("Total hours : %d", total_hours);


    printf("\t\t\tSTUDENT VEHICLE BOOKING FORM\n");
    printf("================================================================================");
    printf("\nAPPLICANT INFORMATION");
    printf("\n================================================================================");
    printf("\nName : %s", &name);
    printf("\t\t\t\tMatric Number : %s\n", &matric_no);
    printf("\nFaculty : %s", &faculty);
    printf("\t\t\t\tMobile Number : %d\n", mobile_no);
    printf("\nDate : %s\n\n", &date);

    printf("================================================================================");
    printf("\nBOOKING INFORMATION");
    printf("\n================================================================================");
    printf("\n\nType of vehicle : %s", &vehicle);
    printf("\n\nBooking Date : %s", &date);
    printf("\n\nBooking Time from: %d hour", time1);
    printf(" to : %d hour", time2);
    printf("\n\nTotal booking time : %d hour", total_hours);
    printf("\n\nDestination : %s", &destination);
    printf("\n\nTravelling Purpose : %s", &travelling_purpose);
    printf("\n\nNumber of passengers : %d", number_passengers);


    return 0;
}

i also got an assignment from my lecturer,.same like u i think

thanks a lot friends for all the help.... You all rock !!!

mior.farhan.9 .... u r from ?

i from malaysia

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.