Rewrite the following if statement by using ternary operator. [2]
if(a<100)
if(a<10)
st=(“Single Digit”);
else
st=(“Double Digit”);
else
st=(“Multiple Digit”);
Answers
Answered by
1
Answer:
Code={a<100? (a<10? Single digit : double digit) :Multiple digit}
Explanation:
PROGRAM IMPLEMENTATION
#include<stdio.h>
#include<conio.h>
int main()
{
int c=3;
c=(c<100?(c<10?printf("single"):printf("double")):printf("multiple"));
}
THE OUT PUT WILL BE SINGLE
HOPE IT HELPS YOU
DO FOLLOW FOR MORE ANSWERS
MARK AS BRAINLIEST
Similar questions