suppose there are five integers write a program to find
larger among them without using if- else
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / brindha
#define<stdio.h>
void main()
{
int num, max = 0;
for (i = 0;i < 5; i ++)
{
scanf("Enter next number: %d", &num);
max = findMax(max, num);
}
printf(" MAX is %d", max);
}
int findMax(int x, int y)
{
int mask = 0, result;
mask = (x - y) >> 31;
result = (~mask & x) | (mask & y);
return result;
}
| Is This Answer Correct ? | 0 Yes | 2 No |
Convert the following expression to postfix and prefix (A+B) * (D-C)
Hi Every one...........I have been selected for the SBI Clerk. But i m one month Pregnanat. So anyone please suggest me, is they take any objection on my joining .
4 Answers State Bank Of India SBI,
write a program to interchange the value between two variable without using loop
HOW TO FIND OUT THE RREVERS OF A GIVEN DIGIT NUMBER IF IT IS INPUT THROUGH THE KEYBORD BY USING C LANGUAGE
GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)
Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user?
Every time i run a c-code in editor, getting some runtime error and editor is disposing, even after reinstalling the software what may be the problem?
1.find the second maximum in an array? 2.how do you create hash table in c? 3.what is hash collision
Why c is called procedure oriented language?
two progs are given. one starts counting frm 0 to MAX and the other stars frm MAX to 0. which one executes fast.
How to draw the flowchart for structure programs?
Is main an identifier in c?