if else if program

IF ELSE IF PROGRAM IN JAVA

IF ELSE IF PROGRAM IN JAVA

import java.util.Scanner;
class computer_sell
{
    static void main ()
    {
        int amount,diamount;
        Scanner Dhiren = new Scanner(System.in);
        System.out.print("Enter the price of laptop : ");
        amount = Dhiren.nextInt();
        if (amount >= 20000 && amount <=30000 )
        {
           amount = amount * (100-15)/100;
           diamount = amount * (14)/100;
           System.out.println(amount+" + "+diamount);
           amount = amount + diamount;
           System.out.println(amount);
        }
        else if (amount>=30000 && amount <= 40000)
        {
        amount = amount * (100-15)/100;
           diamount = amount * (14)/100;
           System.out.println(amount+" + "+diamount);
           amount = amount + diamount;
           System.out.println(amount);   
        }
         else if (amount>=40000 && amount <= 50000)
        {
       amount = amount * (100-15)/100;
           diamount = amount * (14)/100;
           System.out.println(amount+" + "+diamount);
           amount = amount + diamount;
           System.out.println(amount);   
        }
         else if (amount>=50000 && amount <= 60000)
        {
       amount = amount * (100-15)/100;
           diamount = amount * (14)/100;
           System.out.println(amount+" + "+diamount);
           amount = amount + diamount;
           System.out.println(amount);    
        }
    }

}

BEST LAPTOPS IN BUDGETS:-

Output 

if else if program

https://amzn.to/2O6SqCO

Post a Comment

0 Comments