Thread: Need help with this C program

  1. #1
    Registered User
    Join Date
    Sep 2003

    Need help with this C program

    I need serious help with the program I am writing. Here are the requirements.

    Its bank account program. The program asks the user for the amount deposited for the month.
    2. It asks the user for the amount withdrawn for the month.
    3. It calculates the amount of monthly interest. (the monthly intererst rate is the annual rate divided by twelve)
    4. at the end of each iteration, it displays the ending balancce, the total amount of deposits, total amount of withdrawals, and total interest earned.

    I am a beginner programmer who doesnt have a good working knowledge of coding. What I have so far is below:

     #include <stdio.h>
    void main ( )
    int Month;
    double Total = 0.0;
    int Count=0;
    float amount;
    int withdrawal;
    printf("For how many months do you have savings account? \n");
    scanf("%d", & Month);
    while (Count++<Month)
    printf("Enter the amount deposited for Month %d: ", Count);
    scanf("%d", & amount);
    if ((amount,-1)==0);
    printf("Amount should be subtracted from balance.");
    printf("Enter amount withdrawn from savings account?  \n");
    scanf("%f", & amount);
    Any help that can be offered would be greatly appreciated. I am not asking for anyone to write the program for me, I just need help getting the part I have working and completing step3. Thanks

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    void main is wrong

    Learn how to read numbers more effectively

    Use braces (curly brackets) on your while and if statements, and indent accordingly, to make your code easier to read.

    >>if ((amount,-1)==0);
    This does nothing, as you've terminated the line with a ;. A good compiler with warning messages turned on will tell you of this kind of thing.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 01:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM