Sunday, 12 March 2023

4. Write program to create an array of company name and another array of price quoted by the company. Fetch the company name who has quoted the lowest amount.



class Program4
{
    public static void main(String args[])
    {
        String company[] = {"LG","VIVO","OPPO","SAMSUNG","MI"};
        int price[] = {2000,5000,1300,1200,6000};
       
        int min = price[0];
        for(int i=0; i<price.length; i++)
        {
            if(min > price[i])
            {
                min = i;
            }
        }
       
        System.out.print("Lowest amount company: " + company[min]);
       
       
    }
}


No comments:

Post a Comment

python programs

1. sum of two number