INTELLIGENCE BUREAU III
Intelligence Bureau III
The Intelligence Bureau (IB) is India's internal intelligence agency. It was recast as the Central Intelligence Bureau in 1947 under the Ministry of Home Affairs. In 1909, the Indian Political Intelligence Office was established in England in response to the development of Indian revolutionary activities, which came to be called the Indian Political Intelligence (IPI) from 1921. This was a state-run surveillance and monitoring agency. The IPI was run jointly by the India Office and the Government of India and reported jointly to the Secretary of the Public and Judicial Department of the India Office, and the Director of Intelligence Bureau (DIB) in India, and maintained close contact with Scotland Yard and MI5.
The Assistant Central Intelligence Officer(ACIO) exam is conducted every year, in one such exam, the marks were distributed as X,Y,Z. A person from exam centre was interested in finding whether these 3 values X,Y,Z are evenly spaced.
[Hint : X, Y and Z need not always be in sorted order].
Function Specification:
Given 3 ints, X, Y, Z, write a function named “findEvenlyDistributed” that accepts 3 integer arguments (X, Y, Z). If these 3 arguments, one is small, one is medium and one is large. This function returns 1 if the three values are evenly spaced, so the difference between small and medium is the same as the difference between medium and large. Else this function returns 0.
Input Format :
Input consists of 3 integers that correspond to X, Y and Z.
Output Format :
Output consists of a string that is either “YES” or “NO”.
Sample Input 1:
10
30
20
Sample Output 1:
YES
Sample Input 2:
10
20
40
Sample Output 2:
NO
#include
int findEvenlyDistributed(int X,int Y,int Z)
{
if((((X+Y)/2)==Z)||(((Y+Z)/2)==X)||(((Z+X)/2)==Y))
return 1;
else
return 0;
}
int main()
{
int x,y,z,ans;
scanf("%d",&x);
scanf("%d",&y);
scanf("%d",&z);
ans=findEvenlyDistributed(x,y,z);
if(ans==1)
printf("YES");
else
printf("NO");
return 0;
}
Comments
Post a Comment