Pages

Write a programme to take input item price and item quantity and make a voucher slip with discount. USING Arrays

INPUT:

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

namespace ConsoleApplication23
{
    class Program
    {
        static void Main(string[] args)
        {
                        int allpprice, sumarray = 0, loop = 1, summofall = 0;
            string dowhile;
            do
            {
           string[] aritemname = new string[1];
            int[] arunitprice = new int[1];
            int[] arquantity = new int[1];
            int[] aritemprice = new int[1];
                Console.WriteLine("enter the {0} item name ",loop);
                aritemname[0] = Console.ReadLine();

                Console.WriteLine("enter the  unit price of  {0} ", aritemname[0]);
                arunitprice[0] = Convert.ToInt32(Console.ReadLine());

                Console.WriteLine("enter the quantity of  {0}  ", aritemname[0]);
                arquantity[0] = Convert.ToInt32(Console.ReadLine());

               
                aritemprice[0] = arunitprice[0] * arquantity[0];
              

                sumarray = sumarray + aritemprice[0];
                Console.WriteLine("do you want to purchase more items ");
                dowhile = Console.ReadLine();
                loop++;
            }
               while(dowhile!= "n");
           
            allpprice = sumarray;
           
            summofall = summofall + allpprice;
            Console.WriteLine("the total price of all products  {0}",summofall );



        }
    }
}   

OUTPUT:


1 comment: