0
C# Get that discount. Why is the Code not working?
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { int totalPrice = Convert.ToInt32(Console.ReadLine()); //call the method Console.Write(Discount(totalPrice)); } //complete the method declaration static int Discount(int t) { //complete the method body if (t >= 10000){ t = (int)(t * 0.8f); return t; } } } }
2 odpowiedzi
+ 1
put return statement outside if block.
0
What’s not working about it? Could you be more specific? What happens when you launch the program?