how to find the largest element of array without using relational operater?
Answer Posted / upendra singh and avinash cho
#include<stdio.h>
#include<string.h>
void main()
{
int arr[4]={1,10,5,4},c,i,k,j=1;
k=arr[0];
for( i=0;i<3;i++)
{ c=k-arr[i+1];
c=c>>15;
if(c)
k=arr[i+1];
}
printf("largest number %d",k);
getch();
}
| Is This Answer Correct ? | 25 Yes | 11 No |
Post New Answer View All Answers
Can you please explain the scope of static variables?
Differentiate between Macro and ordinary definition.
What does #pragma once mean?
What is equivalent to ++i+++j?
Write a program to swap two numbers without using third variable in c?
What are the rules for the identifier?
What is 1d array in c?
What is string length in c?
What are the __date__ and __time__ preprocessor commands?
What is the basic structure of c?
The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference
What is the use of typedef in structure in c?
What is floating point constants?
What does 3 periods mean in texting?
In cryptography, you could often break the algorithm if you know what was the original (plain) text that was encoded into the current ciphertext. This is called the plain text attack. In this simple problem, we illustrate the plain text attack on a simple substitution cipher encryption, where you know each letter has been substituted with a different letter from the alphabet but you don’t know what that letter is. You are given the cipherText as the input string to the function getwordSets(). You know that a plain text "AMMUNITION" occurs somewhere in this cipher text. Now, you have to find out which sets of characters corresponds to the encrypted form of the "AMMUNITION". You can assume that the encryption follows simple substitution only. [Hint: You could use the pattern in the "AMMUNITION" like MM occurring twice together to identify this]