Problem Description
Each Sunday, a newspaper agency sells x copies of a certain newspaper for Rs.a per copy. The cost to the agency of each newspaper is Rs.b
The agency pays a fixed cost for storage, delivery and so on of Rs.100 per Sunday.
The newspaper agency wants to calculate the profit obtained on sundays. Can you please help them out by writing a C program to compute the profit given x, a and b.
Input Format:
Input consists of 3 integers --- x, a and b. X is the number of copies sold, a is the cost per copy and b is the cost the agency spends per copy.
Output Format:
Refer Sample Input and Output for exact formatting specifications.
Sample Input and Output:
[All text in bold corresponds to input and the rest corresponds to output]CODING ARENA::
#include <stdio.h>
int main()
{
int a,b,c,profit,cost;
scanf("%d%d%d",&a,&b,&c);
cost=(a*b)-(a*c);
profit=cost-100;
printf("The profit obtained is Rs=%d",profit);
return 0;
}
Test Case 1
Input (stdin)1000 2 1
Expected OutputThe profit obtained is Rs=900
Test Case 2
Input (stdin)5000 3 2
Expected OutputThe profit obtained is Rs=4900
No comments:
Post a Comment