in Education by
8. Rewrite the following using ternary operator. (a) if (bill>10000) discount=bill*10.0/100; else discount=bill*5.0/100; Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
Answer: discount =(bill>10000)?bill* 10.0/100:bill*5.0/100;. Explanation: when rewriting an if else snippet into ternary operator ,the … 12 votes Answer:discount =(bill>10000)?bill*10.0/100:bill*5.0/100;Explanation:when rewriting an if else snippet into ternary operator,the syntax is :variable

Related questions

0 votes
    int find(int j) { if(>1X j=find(j/ 10)+(%10); } else { j=0; return j; void main() int i=1000, int k; k=find(i); printf(“%d”, k); Select the correct answer from above options...
asked Dec 29, 2021 in Education by JackTerrance
0 votes
    int fun(int n) { if(n!=0) { return n – fun(n-5); } else { return n; } } int main(){ int n = 20, z; z = fun(n); printf(“%d”, z); } Select the correct answer from above options...
asked Dec 31, 2021 in Education by JackTerrance
0 votes
    s=ScHoO12@CoM' k=1en(s) m= for i in range (0 , k ) : if(s ( i ) . isupper ( ) ) : m=m+s ( i ) . ... else : m=m+ bb print ( m )| Select the correct answer from above options...
asked Dec 14, 2021 in Education by JackTerrance
0 votes
    s=ScHoO12@CoM' k=1en(s) m= for i in range (0 , k ) : if(s ( i ) . isupper ( ) ) : m=m+s ( i ) . ... else : m=m+ bb print ( m )| Select the correct answer from above options...
asked Dec 14, 2021 in Education by JackTerrance
0 votes
    Write a program Using random number generation create a file of 10000 integers in the range 1 to 20000 Select the correct answer from above options...
asked Nov 27, 2021 in Education by JackTerrance
0 votes
    Rewrite the following JAVA program segment using switch case.. char code; if(code=='B'||code=='b') System.out. ... now .plz help me . Select the correct answer from above options...
asked Dec 17, 2021 in Education by JackTerrance
0 votes
    Plz write a program for the following pattern in Java class 10 ICSE 2 6 12 20 30 42 4 6 8 10 12 2 2 2 ... spam. Answer only if you know Select the correct answer from above options...
asked Nov 30, 2021 in Education by JackTerrance
0 votes
    Write a JAVA program. A computer manufacturing company offers 20% discount on laptop. If the price of any laptop ... ANY INPUT METHOD Select the correct answer from above options...
asked Dec 22, 2021 in Education by JackTerrance
0 votes
    Write a JAVA program. A computer manufacturing company offers 20% discount on laptop. If the price of any laptop ... discounted price. Select the correct answer from above options...
asked Dec 21, 2021 in Education by JackTerrance
0 votes
    2. Who is fonder of Facebook? * 实 Bill gates ОО Markzuckerberg O Vinton grey cerf O Bill kendrick Select the correct answer from above options...
asked Dec 14, 2021 in Education by JackTerrance
0 votes
    Give the output of for(i=0;I is less than =100;I++); System.out.println(I); Select the correct answer from above options...
asked Dec 15, 2021 in Education by JackTerrance
0 votes
    Does Python have a ternary conditional operator?...
asked Jan 9, 2021 in Technology by JackTerrance
0 votes
    Write instruction in interactive mode for the following: (i) to display sum of 8,9.0,2*3 (ii) to print sum of 8,9.0,2*3 Select the correct answer from above options...
asked Dec 2, 2021 in Education by JackTerrance
0 votes
    A lot of 100 watches is known to have 10 defective watches. If 8 watches are selected (one by one with ... least one defective watch? Select the correct answer from above options...
asked Nov 20, 2021 in Education by JackTerrance
...