0% found this document useful (0 votes)
38 views1 page

Program: Using Using Using Using Namespace Class Static Void String

The document contains C# code that calculates discounts on purchases based on total cost. It prompts the user to enter the number of products and their individual prices, calculates a running total, and determines if a 20%, 30%, or 40% discount applies based on the total reaching thresholds of 5000, 10000, or 15000 respectively. It then displays the potential or actual discount, final total price after applying any discount, and ends the program.

Uploaded by

zagordarkwood
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views1 page

Program: Using Using Using Using Namespace Class Static Void String

The document contains C# code that calculates discounts on purchases based on total cost. It prompts the user to enter the number of products and their individual prices, calculates a running total, and determines if a 20%, 30%, or 40% discount applies based on the total reaching thresholds of 5000, 10000, or 15000 respectively. It then displays the potential or actual discount, final total price after applying any discount, and ends the program.

Uploaded by

zagordarkwood
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Koliko proizvoda kupujete?");
int n = int.Parse(Console.ReadLine());
int[] cene = new int[n];
Console.WriteLine("Unesite cene proizvoda:");
int i;
int racun = 0;
int popust = 0;
for (i = 0; i < n; i++)
{
Console.Write("Cena proizvoda broj " + (i + 1) + ": ");
cene[i] = int.Parse(Console.ReadLine());
racun += cene[i];
if (racun >= 15000)
popust = 40;
else if (racun >= 10000)
popust = 30;
else if (racun >= 5000)
popust = 20;
Console.WriteLine();
Console.WriteLine("Trenutno stanje na racunu: " + racun);
if (popust == 20 || popust == 30)
Console.WriteLine("Potencijalni popust je " + popust + "%");
if (popust == 40)
Console.WriteLine("Popust je " + popust + "%");
Console.WriteLine();
}
if (popust != 0)
{
Console.WriteLine("Vas ukupni racun je " + racun);
Console.WriteLine();
Console.WriteLine("Popust koji imate je: " + popust + "%");
Console.WriteLine();
Console.WriteLine("Finalna cena: " + (racun - racun * popust / 100));
}
else
Console.WriteLine("Finalna cena: " + racun);
Console.ReadKey();
}
}
}

You might also like