suppose there are five integers write a program to find
larger among them without using if- else
Answer Posted / icywind
#include <stdio.h>
#define SIZE 5
int main(void)
{
int array[] = {100, 32, 22, 500, 21};
int max=0,ii;
for( ii = 0; ii<SIZE; ii++)
{
max = (array[ii]>max)?array[ii]:max;
}
printf("max = %d\n", max);
return 0;
}
| Is This Answer Correct ? | 7 Yes | 1 No |
Post New Answer View All Answers
How do I copy files?
What do the functions atoi(), itoa() and gcvt() do?
What is the function of this pointer?
Explain what is a static function?
Differentiate between a for loop and a while loop? What are it uses?
What does the file stdio.h contain?
Why is C language being considered a middle level language?
Why we write conio h in c?
Read the following data in two different files File A: aaaaaaaadddddddd bbbbbbbbeeeeeeee ccccccccffffffff File B: 11111111 22222222 33333333 By using the above files print the following output or write it in the Other file as follows aaaaaaaa11111111dddddddd bbbbbbbb22222222eeeeeeee cccccccc33333333ffffffffffff
Why should I prototype a function?
What is build process in c?
What is the most efficient way to count the number of bits which are set in an integer?
What is the difference between Printf(..) and sprint(...) ?
How can I pad a string to a known length?
How pointers are declared?