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[^]

14,981,861 members

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?".