## Posts

Showing posts from July, 2015

### ZOHO find new friends in social network ??

Help john to find new friends in social network

Input:

3
Mani 3 ram raj guna
Ram 2 kumar Kishore
Mughil 3 praveen Naveen Ramesh

Output:

Raj guna kumar Kishore praveen Naveen Ramesh

#include<stdio.h>#include<conio.h>#include<string.h>#define N 10struct Node{char name[20];charlist[N][20];int no;}friends[N];void findFriend(int n){int i,j,k,count,m;for(i=0;i<n;i++){ m = friends[i].no;for(j=0;j<m;j++){for(k=count=0;k<n;k++){if( strcmpi(friends[i].list[j],friends[k].name)!=0){count++;}}if(count==n)printf("%s",friends[i].list[j]);}}}intmain(){int t,n,i,j; clrscr();scanf("%d",&t);for(i=0;i<t;i++){scanf("%s",friends[i].name);scanf("%d",&n); friends[i].no = n;for(j=0;j<n;j++){scanf("%s",friends[i].list[j]);}} findFriend(t); getch();}

### Zoho Interview | Set 5 (On-Campus Drive)

#include<stdio.h>#include<conio.h>#define N 6void display(int a[N][N]){int i,j;for(i=0;i<N;i++){for(j=0;j<N;j++)printf("%4d",a[i][j]);printf("\n\n");}}void rotateMatrix(int a[N][N],int b[N][N]){int i,j,temp,times,end,start; times =0; end = N-1; start =0; temp = N/2;while(times < temp){ i = j = times; b[i][j++]= a[i+1][j];while( j < end ){ b[i][j++]= a[i][j-1];} b[i++][j]= a[i][j-1];while( i < end ){ b[i++][j]= a[i-1][j];} b[i][j--]= a[i-1][j];while( j > start ){ b[i][j--]= a[i][j+1];} b[i--][j]= a[i][j+1];while( i > start )

### e-Shop

#include<stdio.h>#include<conio.h>#include<stdlib.h>#include<string.h>#define N 3struct Product{char name[20];int price;int discount;int selected;}product[N];struct Customer{char name[20];struct Product list[N];char credit[20];double amount;}cust;void intialProductList();void displayList();int getDiscount(){srand(time(NULL));return(rand()%6+1);}double discountPrice(struct Product node){double temp;//printf("\n>>%f",k); temp =((double)node.price/(double)100)* node.discount ;//printf("---%lf",temp);return temp;}void display(struct Product product){printf("\n-----------------------------------------");printf("\n\n\tName :: %s",product.name);printf("\n\tMRP Price :: %d",product.price);printf("\n\tDiscount:: %d%%",product.discount);printf("\n\tDiscount Price :: %.2lf",discountPrice(product));printf("\n-----------------------------------------"); getch();}void displayList(){int i…

### Dividing numbers by 9, 99, 999 and so on

By now you know how to divide any number by 9, 90, 900and so on at an extremely fast speed simply by adding the digits of the dividend. Here is an inquisitive method to divide numbers by 9, 99, 999, 9999 and so on in the fastest way if; the dividend is evenly divisible by the number consisting of only 9 (Divisor).the number of digits of the divisor (9’s) is half or more than the number of digits of the dividend i.e. dividing a 4-digits number by 99 or 999, a 6-digits number by 999 or 9999 or 99999, an 8-digits number by four 9’s or more ... and so on.The Trick:
If the above criteria are met all you need to do is:
Starting from the right-digit omit as many digits(s) of the dividend as there are in the divisor (number made up of 9’s) and then add 1 to the rest part of the dividend. That’s all. However, in case a dividend is also made up of 9 only; then add 2. Let’s say you want to divide 8217 by 99
Notice that, 8217 is a 4-digits number which is to be divided by a 2-digit number 99.
So, omi…

### Extracting Cube Roots Mentally

A cube is a number multiplied by itself twice more. For example, 3 cubed (33) is 3×3×3, or 27. A cube root is the number that, when cubed, results in a given number. For example, the cube root of 27 is 3.
Here is the fastest and easiest technique of extracting Cube Roots mentally. A bit of homework is required for this trick. First, memorize the cubes of the digits 1 through 10:      13 = 1      23 = 8      33 = 27      43 = 64      53 = 125      63 =  216      73 =  343      83 =  512      93 =  729    103 = 1000
Also keep in mind the "endings" (or last digit) of the cubes. For example, the ending of 93 is 9, because 93 = 729. So let's make a list. If the number ends in:

0 -> the last digit of the cube root is 0. 1 -> the last digit of the cube root is 1. 2 -> the last digit of the cube root is 8. 3 -> the last digit of the cube root is 7. 4 -> the last digit of the cube root is 4. 5 -> the last digit of the cube root  is 5. 6 -> the last digit of the cube root is 6. …