Month: May 2017

Strict Professor – Class Cancellation

           Strict Professor - Class Cancellation In a college, a professor is strict and mandates that at least M students out of the total N students must arrive on time to his class. Else he would cancel the class.The start time of the class is also passed as the input.The individual

Smaller Matrix Search [ZOHO]

Smaller Matrix Search [ZOHO] A bigger NxN matrix is passed as the input. Also a smaller MxM matrix is passed as input. The program must print TRUE if the smaller matrix can be found in the bigger matrix. Else the program must print FALSE. Input Format: First line will contain the value of N.Second line will contain

Find next greater number with same set of digits in Java

Find next greater number with same set of digits in Java  Given a number, find next greater number with the same set of digits as original number.For example,if input number is 1234, then output should be 1243if input number is 1342, then output should be 1423if input number is 534976, then output should be 536479 if input

Incorrect Keyboard

                   "Incorrect keyboard"Suman's keyboard got damaged as he dropped it from a considerable distance. As a result instead of K the keyboard may sometimes display T (but will never display K instead of T)Similarly instead of G, the keyboard may sometimes display D, instead of R sometimes

Pattern-2 inverse Floyd Triangle!!

               *          * *       * * *    * * * * * * * * *                        '     Program(Method 1): #include <stdio.h> void main() {    int i,j,k,n;    printf("Enter the Number of lines:");    scanf("%d",&n);    for(i=1;i<=n;i++)    {     for(k=1;k<=n-i;k++)         printf("%s"," ");

PATTERN -1 (Floyd Triangle)

* * * * * * * * * * * * * * *             Program(Method 1): #include <stdio.h> void main() {    int i,j,n;    printf("Enter the Number of lines:");    scanf("%d",&n);    for(i=1;i<=n;i++)    {             for(j=1;j<=i;j++)                         printf("%s","*");             printf("n");    } }             Program(Method 2 – Best

Embedded Three Digit Numbers Sum in java

Embedded Three Digit Numbers Sum A string S is passed as the input with numbers embedded in it. The program must print the sum of all three digit numbers embedded in the string. The program must print 0 (zero) if no three digit numbers are embedded in the string.Input Format:The first line will contain the

Integer – Sum of Digits

                      Integer - Sum of Digits The program must accept an integer value N as a command line argument and print the sum of the digits in N. Example Input/Output 1:Input:14 Output:5 Example Input/Output 2:Input:1932 Output:15 Code: #include<stdio.h> int main(int argc,char *argv) {     int

Pattern printing Middle Letter- odd length string

Pattern printing Middle Letter- odd length string An odd length string S is passed as the input. The program must print the pattern as described below.Let L be the length of the string and M denote the middle position of the string S. The characters in the string are a(1),...., a(M), .... a(L).- The first