100% SET 4: 5(a) if-else & conditional operator
#include <stdio.h>
int main()
{
int a=4,b=5;
printf("\n a=%d, b=%d",a,b);
if (a<b)
printf("\n a is less than b");
else
printf("\n a is not less than b");
printf("\n\n till now we used if-else condition; Now lets use conditional operator below\n\n");
a<b? printf("a is smaller than b"): printf("a is not smaller than b");
}
int main()
{
int a=4,b=5;
printf("\n a=%d, b=%d",a,b);
if (a<b)
printf("\n a is less than b");
else
printf("\n a is not less than b");
printf("\n\n till now we used if-else condition; Now lets use conditional operator below\n\n");
a<b? printf("a is smaller than b"): printf("a is not smaller than b");
}
తెరమీద
a=4, b=5
a is less than b
till now we used if-else condition; Now lets use conditional operator below
a is smaller than b
a is less than b
till now we used if-else condition; Now lets use conditional operator below
a is smaller than b
కామెంట్లు
కామెంట్ను పోస్ట్ చేయండి
దయచేసి మీ సలహాలను సూచనలను స్పష్టంగా పేర్కొనగలరు. plz see that ur comments are 'acceptable' in a value based society.