Monday, May 24, 2010

I want C codes for mind games using numbers?

#include%26lt;stdio.h%26gt;


#include%26lt;conio.h%26gt;


#include%26lt;string.h%26gt;


void main()


{


int i,j,n,t,l,g,sum=0 ;


int b[4][4]={


{1,3,5,7},


{9,11,13,15},


{17,19,21,23},


{25,27,29,31}


};


int m[3][4]={


{2,3,6,7},


{12,13,16,17},


{22,23,26,27},


};


int u[3][4]={


{4,5,6,7},


{14,15,16,17},


{24,25,26,27}


};


int y[3][2]={


{8,9},


{18,19},


{28,29}


};


int x[3][4]= {


{10,11,12,13},


{14,15,16,17},


{18,19,30,31},


};


int z[3][4]= {


{20,21,22,23},


{24,25,26,27},


{28,29,30,31},


};


char name[20];


clrscr();


printf("\n Welcome to mindgame");


printf("\n\n Enter your name:\t");


gets(name);


fflush(stdin);


The above arr of nos should be disp on the screen and a person is asked to think a no from tat arr and if the no is ther he should enter 1 else 0, the output should be the number in his mind!!


Plz suggest me some codes and tell me how to extend the logic till n numbers

I want C codes for mind games using numbers?
Basically when this game is played with a set of cards , the numbers on the cards are arranged in such a way that the first number on the top left hand corner of each card is a power of 2.





The reason for this that any positive integer can be expressed as a sum of the powers of 2. Thus 7 = 4 + 2 + 1 ; 37 = 32 + 4 + 1 ; 41 = 32 + 8 + 1 and so on.





Now , the remaining numbers have to be arranged on each card in such a way that they can be obtained by adding the powers of 2 on the cards in which they are present. For instance the number 15 can be obtained by adding 8 + 4 + 2 + 1. Since these are the powers of 2 which will figure on the top left hand corner of the first four cards , the number 15 has to appear in the first four cards , and in no other card.





Again , suppose we consider 41 ; since 41 = 32 + 8 + 1 , which are the powers of 2 appearing on the first , fourth and sixth cards , 41 should appear only in the first , fourth and sixth cards , not in any other.





basically it comes down to arranging all the numbers in the right cards ; in your program it will be the right arrays.


No comments:

Post a Comment