Click here to Skip to main content
15,867,834 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
The input is 200, 230 & 240 are the salaries of 3 persons & 40, 50 & 20 are their respective expense.

output required is maximun amount among those friends after spending their expenditure i.e equal to 220

What I have tried:

#include<stdio.h>
int main()
{
int salary, expenditure;
scanf("%d%d",&salary,&expenditure);
t= salary - expense;
printf("%d",t);
return 0;
}
Posted
Updated 3-Apr-21 19:36pm
Comments
jeron1 3-Apr-21 19:22pm    
You haven't asked a question.
[no name] 4-Apr-21 0:22am    
I had asked, if you think you can answer then plz tell me the solution
OriginalGriff 4-Apr-21 1:59am    
No, you haven't. You've copy'n'pasted your homework, thrown some code together that doesn't strat to solve it, and expected others to finish it for you so you can hand it in and get back to your console game.

A question would be "how do I read three values?" or "How do I find the largest?" or even "how do I store two values together for three people?".

You need to spend more time on both C & Maths.

Use Variables[^] to hold Salaries & Expenses of 3 persons.

And 3 more variables to get remaining amount after Salary - Expense of each person.

Now Compare values of these 3 variables to find the Maximum.

Here a sample for comparison & Max
C program to find maximum and minimum using functions - Codeforwin[^]
 
Share this answer
 
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 
Comments
thatraja 4-Apr-21 0:54am    
Countered -ve

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900