View Single Post
Old 19-03-2008, 08:46 PM   #423 (permalink)
QwertyManiac
Commander in Chief
 
QwertyManiac's Avatar
 
Join Date: Jul 2005
Posts: 6,658
Default Re: Post ur C/C++ Programs Here

You missed a variable in your printf() statement. The bonus variable I suppose. Or BONUS.

Code:
#include<stdio.h>
#define BASE_SAL 2000.0
#define BONUS 200.0
#define COMMISSION 0.02

//Compiled on linux using geany

int main()
{
    int n;
    float bonus, commission, price;
    float gross_sal;
    printf("\nInput the number of systems sold  ",n);
    scanf("%d",&n);
    printf("\nInput the price of each computer  ",price);
    scanf("%f",&price);
    bonus=BONUS*n;
    commission=COMMISSION*price*n;
    gross_sal=BASE_SAL+bonus+commission;
    printf("Base salary is %f\nBonus is %f\nCommission is %f\nGross salary is %f\n"
    ,BASE_SAL,bonus,commission,gross_sal);
}
__________________
Harsh J
www.harshj.com
QwertyManiac is offline