using System;
class abc
{
float price,discount,total;
public void fun()
{
Console.WriteLine("Enter the price : ");
price=Convert.ToSingle(Console.ReadLine());
if(price<=5000)
{
Console.WriteLine("There is no discount ");
}
else if(price>5000 && price<=10000)
{
Console.WriteLine("Discount is 5% ");
discount=(price*5)/100;
Console.WriteLine("Your discounted amount is : "+discount);
}
else if(price>10000 && price<=15000)
{
Console.WriteLine("Discount is 10%");
discount=(price*10)/100;
Console.WriteLine("Your discounted amount is : "+discount);
}
else if(price>15000 && price<=20000)
{
Console.WriteLine("Discount is 15% ");
discount=(price*15)/100;
Console.WriteLine("Your discounted amount is : "+discount);
}
else
{
Console.WriteLine("Discount is 20% ");
discount=(price*20)/100;
Console.WriteLine("Your discounted amount is : "+discount);
}
total=(price-discount);
Console.WriteLine("Amount payable by user is : "+ total);
Console.ReadKey();
}
}
class price
{
public static void Main(string []args)
{
abc a1=new abc();
a1.fun();
}
}
Output :
class abc
{
float price,discount,total;
public void fun()
{
Console.WriteLine("Enter the price : ");
price=Convert.ToSingle(Console.ReadLine());
if(price<=5000)
{
Console.WriteLine("There is no discount ");
}
else if(price>5000 && price<=10000)
{
Console.WriteLine("Discount is 5% ");
discount=(price*5)/100;
Console.WriteLine("Your discounted amount is : "+discount);
}
else if(price>10000 && price<=15000)
{
Console.WriteLine("Discount is 10%");
discount=(price*10)/100;
Console.WriteLine("Your discounted amount is : "+discount);
}
else if(price>15000 && price<=20000)
{
Console.WriteLine("Discount is 15% ");
discount=(price*15)/100;
Console.WriteLine("Your discounted amount is : "+discount);
}
else
{
Console.WriteLine("Discount is 20% ");
discount=(price*20)/100;
Console.WriteLine("Your discounted amount is : "+discount);
}
total=(price-discount);
Console.WriteLine("Amount payable by user is : "+ total);
Console.ReadKey();
}
}
class price
{
public static void Main(string []args)
{
abc a1=new abc();
a1.fun();
}
}
Output :
No comments :
Post a Comment