program will not run when using simple division...:(

This is a discussion on program will not run when using simple division...:( within the C Programming forums, part of the General Programming Boards category; Not sure what I'm doing wrong. Please help me debug this. Using C. Ch compiler. Code: #include <stdio.h> /* standard ...

  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    21

    program will not run when using simple division...:(

    Not sure what I'm doing wrong. Please help me debug this. Using C. Ch compiler.

    Code:
    #include <stdio.h>			/* standard IO library routines, like printf, scanf */
    
    
    
    
    int main(void)
    {
        
        char length_unit[30];
        float conversion_factor, equal_distance, newmiles;
        
        printf("Enter the name of the length unit you want to convert to> ");
        scanf("%s", &length_unit);
        printf("You entered: %s\n", length_unit);
        printf("Enter the conversion factor> ");
        scanf("%f", &conversion_factor);
        printf("You entered a converison factor of %.4f%s/mile\n", conversion_factor, length_unit);
        printf("Enter the distance in miles > ");
        scanf("%f", &newmiles);
        printf("You entered: %.4f miles \n", newmiles);
        
        equal_distance = coversion_factor / newmiles;
        
        printf("The equivalent distance is %f\n", equal_distance);
        
        return 0;		
    }

  2. #2
    Noob AnishaKaul's Avatar
    Join Date
    Jan 2010
    Location
    Gurgaon, India
    Posts
    115
    Code:
    equal_distance = coversion_factor / newmiles;
    Spelling of conversion_factor mismatch with it declaration!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Builder C++ large files support for simple C program
    By Murfury in forum C Programming
    Replies: 3
    Last Post: 11-23-2007, 02:47 PM
  2. Re-doing a C program to run in Win2000 or XP
    By fifi in forum C Programming
    Replies: 5
    Last Post: 08-17-2007, 05:32 PM
  3. Help with a very simple program
    By htdefiant in forum C++ Programming
    Replies: 13
    Last Post: 08-14-2007, 01:27 PM
  4. Help with small simple program
    By Sonor in forum C Programming
    Replies: 5
    Last Post: 04-02-2005, 06:40 AM
  5. simple frontend program problem
    By gandalf_bar in forum Linux Programming
    Replies: 16
    Last Post: 04-22-2004, 06:33 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21