Program to find largest of three numbers without using comparsion operator?

Answer Posted / a.naga tirupathi rao

#include <stdio.h>
#include <conio.h>
main()
{
int a[i],sum=0,i,j;
for(i=1;i<=3;i++)
{
scanf("%d",&a[i]);
sum=sum+a[i];
}
for(j=sum;j<=sum;j--)
{
for(i=1;i<=3;i++)
{
if(j==a[i])
{
printf("%d is biggest",j);
break;
}
}
}
getch();
}

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you construct an increment statement or decrement statement in C?

747


int far *near * p; means

3127


What is a substring in c?

590


Write a C program on Centralized OLTP, Decentralized OLTP using locking mechanism, Semaphore using locking mechanism, Shared memory, message queues, channel of communication, sockets and a simple program on Saving bank application program using OLTP in IPC?

2177


Are global variables static in c?

681






Can you write the function prototype, definition and mention the other requirements.

664


What is methods in c?

649


What are the uses of a pointer?

685


Differentiate between a for loop and a while loop? What are it uses?

677


When was c language developed?

706


main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none

728


What does it mean when a pointer is used in an if statement?

607


Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

678


What is the heap in c?

647


How to write a code for implementing my own printf() and scanf().... Please hep me in this... I need a guidance... Can you give an coding for c... Please also explain about the header files used other than #include...

4908