CS
cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System;
namespace SoloLearnpractises
{
class Program
{
static void Main(string[] args)
{
int initialPrice = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(Discount(initialPrice));//calling the method
}
static int Discount(int initialPrice)//declaring the method
{
int totalPrice = initialPrice;
if (initialPrice > 9999){
return (int)(totalPrice *0.8); //the same as initialPrice - (initialPrice*0.2)
}
else
{
return totalPrice;
}
}
}
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run