Thread: program is due in 8 min :(

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    20

    program is due in 8 min :(

    Write a program that asks the user to enter the price of an item. It will then compute the 6.5% sales tax amount, and display the original price, the sales tax amount, and the total amount due on three separate lines with appropriate labels.

  2. #2
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    tick tick tick ....
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  3. #3
    Registered User
    Join Date
    Oct 2012
    Posts
    20
    Code:
    #include <stdio.h>
    main()
    {
     
    int value1;
    float num;
    num = 6.5;
    
    printf("Please enter sales price: ");
    scanf ("%i", &value1);
     
    printf ("\n\nYour Sales price is: %i\n", value1);
    printf ("The Sales Tax is: %.1f%\n", num);
    printf ("Your Total is: ");
    getchar();
    }

  4. #4
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    An integer is "%d" in the printf statement. A "%" is printed by using "%%"

    Define main as "int main()" and make sure that it returns a 0 "return 0;"

    Use the "+" and "*" to work out your answers.
    Fact - Beethoven wrote his first symphony in C

  5. #5
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Quote Originally Posted by fenway81 View Post
    program is due in 8 min
    Then posting on here was a waste of your precious remaining time. Nobody on here is going to be able to help you in that timeframe.

    If there is anything to be learned with regards to this project, it is that procrastination will get you nowhere.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  6. #6
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by iMalc View Post
    Then posting on here was a waste of your precious remaining time. Nobody on here is going to be able to help you in that timeframe.

    If there is anything to be learned with regards to this project, it is that procrastination will get you nowhere.
    It's GREAT comedy, admit it! 8 minutes?? < ROFL >

  7. #7
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Unless this is the "call a friend" stage on who wants to be a millionaire I am not interested.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 03-16-2010, 10:17 AM
  2. Replies: 1
    Last Post: 03-03-2009, 04:47 PM
  3. Replies: 48
    Last Post: 09-26-2008, 03:45 AM
  4. Replies: 5
    Last Post: 08-16-2007, 11:43 PM
  5. Replies: 18
    Last Post: 11-13-2006, 01:11 PM