+ 5

Hovercraft programme code coach

I have solved this.but 2/5 test cases faild.i can't identify what is the problem.please help me for identify problem. Is anyone solved this problem

30th Dec 2019, 8:55 AM
Pradeepa Samarathunga
Pradeepa Samarathunga - avatar
16 Antworten
+ 13
Pradeepa Samarathunga You have going on right approach you just missed or interpret one condition wrongly in else you should write "Loss" in the last statement An another way you can try by reducing one variable cost = 21000000 price =3000000 sales = int(input()) if sales*price>cost: print('Profit') elif sales*price==cost: print('Broke Even') else: print('Loss')
30th Dec 2019, 9:20 AM
GAWEN STEASY
GAWEN STEASY - avatar
+ 7
Pradeepa Samarathunga you still not changing the print statement it's "Loss" not "Lose"
30th Dec 2019, 10:41 AM
GAWEN STEASY
GAWEN STEASY - avatar
+ 4
Pradeepa Samarathunga link your code which you have tried to getting solution.
30th Dec 2019, 9:09 AM
GAWEN STEASY
GAWEN STEASY - avatar
+ 3
using System; namespace HoverCraftFactory { class Program { public static void HoverCraftFactory() { int cost = 21000000; int HoverCost = 3000000; int sales = Convert.ToInt32(Console.ReadLine()); int income = sales * HoverCost; if(income>cost) { Console.WriteLine("Profit"); } else if (income ==cost) { Console.WriteLine("Broke Even"); } else if (income<cost) { Console.WriteLine("Loss"); } } public static void Main(string[] args) { HoverCraftFactory(); } } } //Here is an answer
4th May 2020, 9:08 AM
c.codeine
c.codeine - avatar
+ 1
def converter(user): monthly_loss = 21000000 insurance = 1000000 sale_value = 3000000 cost = (user * 3000000) if cost > monthly_loss: return "Profit" elif cost < monthly_loss: return "Loss" elif cost == monthly_loss: return "Broke Even" user = int(input("")) print(converter(user))
30th Jul 2020, 3:21 PM
Artur Wildress
Artur Wildress - avatar
+ 1
Most simple solution. sales = int(input()) if sales * 3 > 21: print('Profit') elif sales * 3 == 21: print('Broke Even') else: print('Loss')
5th Oct 2021, 9:20 PM
krisx2
krisx2 - avatar
+ 1
//I'm using C language #include<stdio.h> int main() { int a,mult; int b=3; int c=21; scanf("%d",&a); mult=(a*b); if (mult>c) printf("profit"); else if(mult==c) printf("Broke Even"); else printf("Loss"); return 0; }
7th Jul 2023, 7:00 AM
Darshini J
Darshini J - avatar
30th Dec 2019, 9:12 AM
Pradeepa Samarathunga
Pradeepa Samarathunga - avatar
0
cost = 21000000 sales = int(input()) income = sales * 3000000 if income > cost : print("Profit") elif income < cost : print("Lose") elif income == cost: print("Broke Even") else: print(None )
30th Dec 2019, 9:13 AM
Pradeepa Samarathunga
Pradeepa Samarathunga - avatar
0
GAWEN STEASY It looks like easy to work this code. Thank you very much ❤️
30th Dec 2019, 10:06 AM
Pradeepa Samarathunga
Pradeepa Samarathunga - avatar
0
GAWEN STEASY It has got same result ☹️
30th Dec 2019, 10:34 AM
Pradeepa Samarathunga
Pradeepa Samarathunga - avatar
0
GAWEN STEASY I got it.all test cases pass.i have written it as Lost and now corrected to Loss. Thank you so much ❤️
30th Dec 2019, 10:44 AM
Pradeepa Samarathunga
Pradeepa Samarathunga - avatar
0
Why everyone is taking cost as 21,000,000?
15th Aug 2020, 4:53 AM
Arya Deep Chowdhury
Arya Deep Chowdhury - avatar
0
#define MONEY_SPENT 21000000 #define PRICE_PER_UNIT sold*3000000 int main() { int sold; cin >> sold; if(PRICE_PER_UNIT < MONEY_SPENT) cout << "Loss" << endl; else if(PRICE_PER_UNIT == MONEY_SPENT){ cout << "Broke Even" << endl; }else cout << "Profit"; }
30th Jan 2021, 3:48 AM
Sou o PeddoBear (PeddoRicko)
Sou o PeddoBear (PeddoRicko) - avatar
0
sold = int(input()) total_cost = int(21000000) income = int(sold*3000000) if income>total_cost: print("Profit") elif income==total_cost: print("Broke Even") else: print("Loss")
12th Feb 2022, 7:53 PM
Toma Andrei
Toma Andrei - avatar
0
using System; namespace SoloLearn { class Program { static void Main(string[] args) { int sales = Convert.ToInt32(Console.ReadLine()); string result = DetermineProfitStatus(sales); Console.WriteLine(result); } static string DetermineProfitStatus(int soldHovercrafts) { int hovercraftsBuilt = 10; int costToBuild = 2000000; int sellingPrice = 3000000; int insuranceCost = 1000000; int totalCost = hovercraftsBuilt * costToBuild + insuranceCost; int totalRevenue = soldHovercrafts * sellingPrice; if (totalRevenue > totalCost) { return "Profit"; } else if (totalRevenue < totalCost) { return "Loss"; } else { return "Broke Even"; } } } }
30th Aug 2023, 12:39 PM
Okolocha Deborah
Okolocha Deborah - avatar