Thread: Please help me, this is my assignment in C programming language.

  1. #1
    Registered User
    Join Date
    Nov 2016
    Posts
    1

    Post Please help me, this is my assignment in C programming language.

    A taxi charges for $20 for the first 300 meters and $2 for every 200 meters thereafter. Any distance covering the next 200 meters zone is still charged $2. Make a program that input the distance (in Meters) a trip took and output the fee.

    My code so far.

    Code:
    #include <stdio.h>
    
    
    main()
    {
        int meters;
        float taxi_charges;
        
        printf("Input the distance in meters: ");
        scanf("%d",&meters);
        
        if(meters <= 300)
        {
            taxi_charges = 20.0; // I don't have to do what next to code.
        }
    }

  2. #2
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    Can you describe in words the list of steps you would take to solve this problem by hand?
    (In other words, solve the problem on paper before implementing your solution in code.)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Importance of english language in programming language
    By Lea Pi in forum General Discussions
    Replies: 10
    Last Post: 04-17-2015, 07:43 AM
  2. Replies: 3
    Last Post: 04-26-2009, 08:54 AM
  3. New Programming language
    By MacGyver in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 06-04-2007, 02:07 PM
  4. What's the Difference Between a Programming Language and a Scripting Language?
    By Krak in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 07-15-2005, 04:46 PM
  5. which programming language should be used for socket programming?
    By albert_wong_bmw in forum Networking/Device Communication
    Replies: 8
    Last Post: 06-04-2004, 08:12 PM

Tags for this Thread