Tuesday 20 August 2013

J K ROWLING TROLLED


RUPEE V/S DOLLAR


An Advice to all who are worrying about fall of Indian Rupee

Throughout the country please stop using cars except for emergency for only seven days (Just 7 days)
Definitely Dollar rate will come down. This is true. The value to dollar is given by petrol only.This is called Derivative Trading. America has stopped valuing its Dollar with Gold 70 years ago.


Real story of American Dollar v/s Indian Rupee


Americans understood that Petrol is equally valuable as Gold so they made Agreement with all the Middle East countries to sell petrol in Dollars only. That is why Americans print their Dollar as legal tender for debts. This mean if you don't like their American Dollar and go to their Governor and ask for repayment in form of Gold,as in India they won't give you Gold.

You observe Indian Rupee, " I promise to pay the bearer..." is clearly printed along with the signature of Reserve Bank Governor. This mean, if you don't like Indian Rupee and ask for repayment,Reserve Bank of India will pay you back an equal value of gold.(Actually there may be minor differences in the Transaction dealing rules, but for easy comprehension I am explaining this)

Let us see an example. Indian petroleum minister goes to Middle East country to purchase petrol, the Middle East petrol bunk people will say that liter petrol is one Dollar.
But Indians won't have dollars. They have Indian Rupees. So what to do now? So That Indian Minister will ask America to give Dollars. American Federal Reserve will give us dollars by taking Indian Rupees ( according to exchange rate ) , print Dollars on it and give it to the Indian Minister. Like this we get dollars , pay it to petrol bunks and buy petrol.

But there is a something wrong here. If you change your mind and want to give back the Dollars to America we can't demand them to pay Gold in return for the Dollars. They will say " Have we promised to return something back to you? Haven't you checked the Dollar ? We clearly printed on the Dollar that it is Debt"
So, Americans don't need any Gold with them to print Dollars.

But what will Americans give to the Middle East countries for selling petrol in Dollars only?

Middle East kings pay rent to America for protecting their kings and heirs. Similarly they are still paying back the Debt to America for constructing Roads and Buildings in their countries.

At present the problem of India is the result of buying those American Dollars. So if we reduce the consumption of petrol and cars, Dollar will come down

The Above Details have been provided originally in Telugu Language by Madhava Turumella and were translated to English by Radhika Gr. - See more at: http://www.allindiadaily.com/2013/08/real-story-of-american-dollar-vs-Indian-Rupee.html#sthash.URjMqIdI.dpuf

Monday 17 December 2012

C CODE TO GENERATE TO VARIABLE SIZE SEVEN SEGMENT DISPLAY

Now guyz ...
Here's a small crap of how to display a 7 seg. o/p by entering any number ....

Well .. Its a bit crappy to write the i/p and o/p here ..
But just try the code :


#define P printf
#define S scanf
#include<stdio.h>
#include<conio.h>
main()
{
 int n[4],m,size=0,i=0,j=0,cnt=1;
 int temp=0,row=0,col=0,p=0;
while(1)
 {
 P("Enter the size preffered :\n");
 S("%d",&size);
 row=2*size+3;
 col=size+2;
 char matrix[4][row][col];
 temp=(row/2)-1;           

 for(i=0;i<row;i++)
 {
  for(j=0;j<col;j++)
  {
   for(p=0;p<=3;p++)
   {
     matrix[p][i][j]='\0';                 
   }                 
  }
}

 i=0;j=0;
 P("Enter the number.\n");
 fflush;
S("%d %d %d %d",&n[0],&n[1],&n[2],&n[3]);
i=0;j=0;

for(p=0;p<=3;p++)
{
                 
switch(n[p]) //Switch 1
 {
   case 2:
   case 3:
   case 5:
   case 6:
   case 7:
   case 8:
   case 9:
   case 0:
        {
          for(j=1;j<=col-2;j++)
          matrix[p][0][j]='_';              
        
        }break;       
 }//Switch_1 ends

  switch(n[p]) //Switch 2
 {
   case 2:
   case 3:
   case 4:
   case 5:
   case 6:
   case 8:
   case 9:
        {
          
          for(j=1;j<=col-2;j++)
          matrix[p][row/2][j]='_';              
        }break;       
}//Switch_2 ends


  switch(n[p]) //Switch 3
 {
   case 0:
   case 2:
   case 3:
   case 5:
   case 6:
   case 8:
        {
          for(j=1;j<=col-2;j++)
          matrix[p][row-1][j]='_';              
        }break;       
 }//Switch_3 ends
  

  switch(n[p]) //Switch 4
 {
   case 4:
   case 5:
   case 6:
   case 8:
   case 9:
   case 0:

        {
          for(j=1;j<=temp;j++)
          matrix[p][j][0]='|';              
        }break;       
 }//Switch_4 ends 

 switch(n[p]) //Switch 5
 {
   case 0:
   case 2:
   case 6:
   case 8:
        {
          for(j=temp+2;j<=row-2;j++)
          matrix[p][j][0]='|';              
        }break;       
      
 }//Switch_5 ends 


  switch(n[p]) //Switch 6
 {
   case 1:
   case 2:
   case 3:
   case 4:
   case 7:
   case 8:
   case 9:
   case 0:
        {
     
          for(i=1;i<=temp;i++)
          matrix[p][i][col-1]='|';              
        }break;       

 }//Switch_6 ends


 switch(n[p]) //Switch 7
 {
   case 0:
   case 1:
   case 3:
   case 4:
   case 5:
   case 6:
   case 7:
   case 8:
   case 9:
        {
          for(j=temp+2;j<=row-2;j++)
          matrix[p][j][col-1]='|';              
        }break;       
 }//Switch_7 ends 

}//Assignment ends


 for(i=0;i<=row-1;i++)
{
 for(p=0;p<=3;p++)   
   { 
    for(j=0;j<=col-1;j++)
    {  
      P("%c",matrix[p][i][j]);                 
    }
  for(cnt=0;cnt<=size/2;cnt++)
  P(" ");
 }
P("\n"); 
}

P("\n\n\n");
}//While 1 ends ....
getch();

}

Sunday 16 December 2012

USE OF HEADER NODE IN LINKED LIST

The header node is a node of linked list which may or may not have the same data structure of that of a typical node.The only common thing between a typical node and a header node is that they both have a pointer pointing to a typical node.

Such a node can be used to store some extra pointers,for example

1)In a circular linked list it may store a pointer to middle node or an integer that stores the total number of nodes of the list.

2) In a simple linked list it may store a sentinel value like total number of nodes in the list or may point to the last node of the linked list.

Saturday 15 December 2012

TOWER OF HANOI- UNDERSTANDING THE RECURSION


PROBLEM: A stack of disks placed on pole A has to be moved to pole C using pole B as an intermediate pole for transition keeping in mind the condition that a disk of larger diameter cannot be place on that of a smaller diameter.   

SOLUTION : The very essence of solving this problem lies in understanding the recursive nature of the problem.Considering that there  'n' disks on pole A ;the problem can be broken into 3 repeating steps:

AIM: do something to move n disks from A to C using B.

step1: do something to move n-1 disks from A to B using C.

step2:move 'n' th disk from A to C.

step3:do something to move n-1 disks from B to C using A.

Note that the term "do something" is common with the AIM of procedure
steps 1 and 3 . Step 1 and 3 are itself new aims and will follow the same procedure (step 1,2,3 under the aim of step 1 )

Every time step 1 and step 3 will create a new set of procedure which again involve a sub set of procedures.

Here is a code for the tower of hanoi problem :

#include<stdio.h>
void tow(char x,char y,char z,int n);  // function declaration

int main()
{
int h;char a='a',b='b',c='c';
printf("enter the no of disk on stack a");
scanf("%d",&h);
printf("\nmovement of disks from stack a to stack c\n");
tow(a,b,c,h);                                         //function call
return 0;
}

void tow(char x,char y,char z,int n) // function
{
if(n-1>0)
 {
 tow(x,z,y,n-1);                                   // step1
 printf("\nmove  %d th  disk from %c to %c \n",n,x,z); //step2
 tow(y,x,z,n-1);                                  //step3
 }
else
 printf("move %d th disk from %c to %c \n",n,x,z);// when only one disk is left
}







SEGMENTATION FAULT (CORE DUMPED) IN C

Common reason why you would get such an error message despite of no syntax error being spotted after compilation are:

1)you are not passing the memory address of the variable to a scanf statement. for example:

int n;
scanf("%d",n); // wrong statement
scanf("%d",&n);//correct statement
In case of a string ,it is not necessary to place '&' :
char ans[10];
scanf("%s",ans);//correct statement

2)your user defined function is falling into an infinite loop;

void recur(int x)
{
recur(x);

3)if you are playing with strings in your code the it is preferable that you use fflush(stdin) after every input statement;

scanf("%s",ans);
fflush(stdin);