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; } } } }

9th Nov 2022, 4:33 PM
Charles Mwaniki
Charles Mwaniki - avatar
2 ответов
+ 1
put return statement outside if block.
9th Nov 2022, 4:53 PM
Jayakrishna 🇮🇳
0
What’s not working about it? Could you be more specific? What happens when you launch the program?
9th Nov 2022, 4:40 PM
Michael Byers
Michael Byers - avatar