Posts

Showing posts from March 16, 2021

Binary - Case Sensitive Decryption

Binary - Case Sensitive Decryption  PROBLEM STATEMENT : The program must accept a string S representing an encrypted message as the input. The program must decrypt the string S and print the message based on the following conditions.  - The program must split the string S into substrings of equal length 5 .  - For each substring, the program must form a binary representation by replacing the lower case alphabets with 0 and the upper case alphabets with 1 .  Then the program must find the decimal equivalent of each binary representation and replace them with the characters as given below. From 0 to 25 -> a to z.  26 -> . (dot)  27 -> , (comma)  28 -> a SPACE character  29 -> ? (question mark symbol)  30 -> ' (single quote)  31 -> " (double quote)  Note: The string S contains only alphabets and its length is always a multiple of 5.  Boundary Condition(s):  1 <= Length of S <= 1000...

Alternate Sorting of Numbers

 Alternate Sorting of Numbers PROBLEM STATEMENT : Given an array of integers, rearrange the array in such a way that the first element is first maximum and second element is first minimum. The third element must be second maximum and fourth element must be second minimum and so on.  Input Format:  The first line will contain the numbers separated by a space.  Boundary Conditions:  Length of the input string will be from 3 to 200.  Output Format:   The numbers separated by a single space as per the mentioned conditions.  Example Input/Output 1: Input: ( ) 2 3 4 7 Output: 7 2 4 3 Example Input/Output 2: Input: ( ) 1 2 3 4 5 6 7 Output: 7 1 6 2 5 3 4 Example Input/Output 3: Input: ( ) 23 55 Output: 55 23 SOLUTION : C (Programming Language) Copy Code #include<stdio.h> #include<stdlib.h> int fun(const void *a,const void *b) { return (*(int*)a - *(int*)b); } int main() { int n=-1,a[201],i; while(scanf...