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
A routine usually part of the operation system that loads a program into memory prior to execution a) linker b) loader c) preprocessor d) compiler
Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.
What are preprocessor directives?
What is static identifier?
How many types of operators are there in c?
What is putchar() function?
write a program in C that prompts the user for today's date,tomorrow's date and display the results.Use structures for today's date,tomorrow's date and an array to hold the days for each month of the year.
An application package has been provided to you without any documents for the following application. The application needs to be tested. How will you proceed?
Tell me the use of bit field in c language?
How do I read the arrow keys? What about function keys?
Write a program to replace n bits from the position p of the bit representation of an inputted character x with the one's complement. Method invertBit takes 3 parameters x as input character, p as position and n as the number of positions from p. Replace n bits from pth position in 8 bit character x. Then return the characters by inverting the bits.
What are the back slash character constants or escape sequence charactersavailable in c?
Why c is known as a mother language?
How does placing some code lines between the comment symbol help in debugging the code?
int i=10; printf("%d %d %d", i, i=20, i);