+ 1
SUPER SALE i did the example on my code it gave me the right answer i don't know where the bug is because my math is right
11 odpowiedzi
- 1
I wrote my Code now you can see how I done it.
https://code.sololearn.com/ccJTkC5oBWCC/?ref=app
+ 1
I didn't try it myself but that you Code don't Work let me belive that the Last 3 Test cases aren't Just 3 Elements. You Code's just for 3 elements but the Challenge say nothing about just 3 Elements.
I would recommend you to try the List.Sort() Method to find out about the biggest payment and then calculate.
+ 1
Thank you so much its works great
0
I get the first 3 ones right but fail the last three
0
I would Most likely do it Like that:
List<double> list = new List<double>();
string input;
double discount = 0.7;
double taxes = 1.07;
input = Console.ReadLine();
foreach(string word in input.Split(','))
{
double nums = Convert.ToDouble(word);
list.Add(nums);
}
nums.Sort((a, b) => b.CompareTo(a));
int sumb = nums.Sum()*taxes;
for(int i = 1; i < nums.Count; i++)
{
nums[i] *= discount;
}
Console.WriteLine(Math.Floor(sumb - nums.Sum()*taxes));
The Code is probably false but I hope the idea how it could be done goes through. :)
0
Thank youu i will give it a try
0
Nadhil An that have nothing to do with the question
0
But its not working.it saws errors
0
But that isn't a Code from this question.
- 1
#include<stdio.h>
int main(void)
{
int num1,num2;
printf("enter two numbers");
scanf("%d%d",&num1,&num2);
if(num1>number2){
printf("greater number is %d", number1);
}else{
printf("greater number is %d", number2);
}
return 0;
}
What is the mistake on this?
- 2
Cool