Friday, January 21, 2011

Operators and Expressions

The straight line method of computing the yearly depriciation of the of and item is given by:
Depriciation=(Purchase price - Salvage value)/years of service.
Write a program to determine the salvage value of an item when the purchase
price years of service and annual depriciation are given.

#include<stdio.h>
void main()
{
float depriciation,P-P,S-V,Y-S;
printf("Enter purchase price,years of service and annual depriciation\n\n");
scanf("%f %f %f",&P-P,&Y-S,&depriciation);
S-V=P-P-depriciation*Y-S;
printf("Salvage value =%8.2f",S-V);
getch();
}

No comments:

Post a Comment