Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

if else to ternary converter online

#include<stdio.h>
int main()
{
	int grade,ans;
	printf("Enter your grade:
");
	scanf("%d",&grade);
			
	ans = (grade<=75?(grade<=100?printf("A."):printf("Fail.")):(grade>=59?(grade<=74?printf("B."):printf("Fail."));));
			
	return 0;						
			
	   
}
Comment

convert if else to ternary operator online

import java.util.Scanner;

public class LIC
{
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        System.out.print("Enter Name: ");
        String name = in.nextLine();
        System.out.print("Enter Sum Assured: ");
        double sum = in.nextDouble();
        System.out.print("Enter First Premium: ");
        double pre = in.nextDouble();
        double disc = 0.0, comm = 0.0;

        if(sum <= 100000){
            disc = pre * 5.0 / 100.0;
            comm = sum * 2.0 / 100.0;
        }
        else if(sum <= 200000){
            disc = pre * 8.0 / 100.0;
            comm = sum * 3.0 / 100.0;
        }
        else if(sum <= 500000){
            disc = pre * 10.0 / 100.0;
            comm = sum * 5.0 / 100.0;
        }
        else{
            disc = pre * 15.0 / 100.0;
            comm = sum * 7.5 / 100.0;
        }

        System.out.println("Name of the policy holder: " + name);
        System.out.println("Sum assured: " + sum);
        System.out.println("Premium: " + pre);
        System.out.println("Discount on the first premium: " + disc);
        System.out.println("Commission of the agent: " + comm);

    }
}
Comment

convert if else to ternary operator online

import java.util.Scanner;

public class KboatLICPolicy
{
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        System.out.print("Enter Name: ");
        String name = in.nextLine();
        System.out.print("Enter Sum Assured: ");
        double sum = in.nextDouble();
        System.out.print("Enter First Premium: ");
        double pre = in.nextDouble();
        double disc = 0.0, comm = 0.0;

        if(sum <= 100000){
            disc = pre * 5.0 / 100.0;
            comm = sum * 2.0 / 100.0;
        }
        else if(sum <= 200000){
            disc = pre * 8.0 / 100.0;
            comm = sum * 3.0 / 100.0;
        }
        else if(sum <= 500000){
            disc = pre * 10.0 / 100.0;
            comm = sum * 5.0 / 100.0;
        }
        else{
            disc = pre * 15.0 / 100.0;
            comm = sum * 7.5 / 100.0;
        }

        System.out.println("Name of the policy holder: " + name);
        System.out.println("Sum assured: " + sum);
        System.out.println("Premium: " + pre);
        System.out.println("Discount on the first premium: " + disc);
        System.out.println("Commission of the agent: " + comm);

    }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: -1 in javascript 
Javascript :: Unexpected eval or arguments in strict mode 
Javascript :: google removing javascript from chrome 
Javascript :: decode hex to string js 
Javascript :: javascript fix errora 
Javascript :: select text with vim vscode 
Javascript :: js cannot use import statement outside a module 
Javascript :: vscode autosuggest background 
Javascript :: This will give Iodoform reaction on the treatment with Na2CO3 and I2: 
Javascript :: all callbacks and function for iCheck plugin 
Javascript :: find duplicate characters from string in javascript 
Javascript :: video playing 
Javascript :: bootstrap off canvas not working 
Javascript :: blank array condition in react js 
Javascript :: return where an property eqauls 
Javascript :: how to reset count in react 
Javascript :: how to disable background when popup open in javascript 
Javascript :: how to detect two objects overlapping in javascript 
Javascript :: Event listener with single mouse click in extendscript 
Javascript :: React custom hook refetch data 
Javascript :: dot notation vs bracket notation javascript 
Javascript :: adding object into object 
Javascript :: check if object is empty js 
Javascript :: javascript ejemplo de template literal anidados 
Javascript :: json schema script 
Javascript :: node base64 svg to png 
Javascript :: React Native - Trigger Media Scanner 
Javascript :: lucastools version info getter 
Javascript :: js comment out 
Javascript :: cookie clicker get all badges hack 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =