write a c program for greatest of three numbers without
using if statment

Answers were Sorted based on User's Feedback



write a c program for greatest of three numbers without using if statment..

Answer / sathishmani

void main()
{
int a=10,b=20,c=30,d;
d=((a>b)&&(a>c))?1:2;
switch(d)
{
case 1:
printf("%d",a);
break;
case 2:
d=(b>c)?b:c;
printf("%d",d);
break;
}
}

Is This Answer Correct ?    68 Yes 21 No

write a c program for greatest of three numbers without using if statment..

Answer / swathi

main()
{
int a,b,c,s1,big;
printf("enter 3 values");
scanf("%d %d %d", &a,&b,&c);
s1=(a>b)? a : b;
big= (s1>c)? s1 : c;
printf("largest of 3 no's=%d",big);
}

Is This Answer Correct ?    23 Yes 6 No

write a c program for greatest of three numbers without using if statment..

Answer / ragu

int call();
void main()
{
int a,b,c,d;
printf("enter the values");
scanf("%d%d%d",&a,&b,&c);
d=call();
}
call()
{
return(a>b?a>c?a:c:b>c?b:c);
}

Is This Answer Correct ?    28 Yes 19 No

write a c program for greatest of three numbers without using if statment..

Answer / suresh

main()
{
int a,b,c,big;
printf("enter 3 values");
scanf("%d %d %d", &a,&b,&c);
big= ((a>b)&&(a>c))? a :b>c?b:c;
printf("largest of 3 no's = %d",big);
}

Is This Answer Correct ?    6 Yes 2 No

Post New Answer

More C Interview Questions

What are register variables in c?

0 Answers  


Is fortran still used in 2018?

0 Answers  


What is call by reference in functions?

1 Answers  


What are the 5 elements of structure?

0 Answers  


What is actual argument?

0 Answers  


write a 'c' program to sum the number of integer values

8 Answers  


if the total selling price of 15 items and the total profit earned on them is input through the keyboard, write a program to find the cost price of one of the item

2 Answers  


What is volatile keyword in c?

0 Answers  


how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12

0 Answers  


What is openmp in c?

0 Answers  


What is the acronym for ansi?

0 Answers  


design and implement a data structure and performs the following operation with the help of file (included 1000 student marks in 5 sub. and %also) 1.how many students are fail in all 5 subjects (if >35) 2. delete all student data those are fail in all 5 subjects. 3. update the grace marks (5 no. if exam paper is 100 marks) 4. arrange the student data in ascending order basis of marks. 5.insert double of deleted students with marks in the list.

0 Answers   TCS,


Categories