Sunday, 31 December 2017

HIDDEN FACTS - 03

                         TOP TEN
Welcome guys.... The topic is Top Ten of Kollywood songs.. It is selected based on the massive hit of 2017....

Top 10 Songs of 2017 :

10. Thandhiraa - Adhe kangal
      Venpani malarae - Power pandi

9. Kalukku machan - Sakka podu podu raja 

8.Thangachi - Meyadha Maan

7.Iraiva - Velaikkaran

6.Kaadhalaada - Vivegam

5.Yaanji - Vikram Vedha

4.Machi engalukku ellam - Meesaya murukku

3.Yaaro ucchi kilay meley - Taramani

2.Mersal Arasan - Mersal

1.Alaporan Tamizhan - Mersal

       In the above content is not to harm anybody. If there is any mistake, share your thoughts in the comment box. 

Saturday, 30 December 2017

HIDDEN FACTS - 02

    KINGDOM OF ANDROID MOBILE

welcome guys.... The topic is Kingdom of androids and Android mobile..... Now, there is not only a mobile also a television, watch, etc., Now, all household appliances are android. we are not reject anything, because it must for us. It makes easy to work.
The android mobiles are develop fast. It is develop by Google. Now,government also computerized. So, all peoples must have smart phones.Most of the people bought smart phones means Android mobiles. Android mobiles are huge developing. Jio also help to develop Android phones.

Android watch is also most of the people used. I think it is used only particular type of peoples. But it is quite nice.
Android television is also most of the people bought and used. It provides channels additionally Internet. It supports YouTube, and other social medias.Recording the TV shows and also use pendrive.
we are live in the world of Android. so, the kingdom of Android is not far, it is near.

Is that we all need android?
          yes, most of the people choose this because they are run for their life. This system is help that people not only that people those who are running.

In the above content is only share the things whatever I know. If anything is missed or anything I didn't mentioned means comment below. It is not to harm anybody. SHARE YOUR LOVE..... SPREAD YOUR LOVE.... 

Monday, 25 December 2017

Finding the day using the given date

     

  Hello,here you can find the program which gives what will be the day of the date you asked.
         This program works on the principle of odd days.

Program

#include<stdio.h>
#include<conio.h>
void main()
{
int day,month,year,odd=0,m[12]={3,0,3,2,3,2,3,3,2,3,2,3},i,rem=-1,ch;
clrscr();
scanf("%d %d %d",&day,&month,&year);
if(day<=31 && day>0 && month>0 && month<=12 &&year>0)
{
odd=odd+day;
for(i=0;i<month-1;i++)
odd+=m[i];
       rem=year%400;

       if(rem<=200 && rem>0){
       for(i=1;i<rem;i++)
       {
if((i%4)==0)
{
odd+=2;
}
else
{
odd+=1;
}
       }
       }
       else if(rem>200)
       {
rem=400-rem;
for(i=rem;i>1;i--)
{
if((i%4)==0) odd+=2;
else
odd+=1;
}
       }
       if(rem==0) odd--;
       ch=odd%7;
       switch(ch)
       {
case 0:printf("SUNDAY");
break;
case 1:printf("MONDAY");
break;
case 2:printf("TUESDAY");
break;
case 3:printf("WEDNESDAY");
break;
case 4:printf("THURSDAY");
break;
case 5:printf("FRIDAY");
break;
case 6:printf("SATURDAY");
break;
       }
    }
    else
printf("Error in the date you have mentioned\n");
}

Output:





If you want to know the principle of odd days comment below,i am sured that i will explain.

    Thank you and keep supporting me.

Wednesday, 13 December 2017

HIDDEN FACTS - 01

              I will be watching you
     
 The topic is I WILL BE WATCHING YOU. It's not a Kamal Hassan's dialogue and not a Big boss show.It's about ours.

Then who is watching me??!!
      Now a days,most of the people used Android mobile.That is watching you and controls you. If somebody buy a new android mobile. It ask to create a new Google account and link with mail id. If you install any apps, it will ask to link with Google account.
Then only you will access the app.Then you will install Facebook, Whatsapp,Twitter, Hike,Flipkart, skype and all Other social media's because now it's necessary for everybody.

If anything browse in Google, ads are in the websites.The website ads are what we are browse in the Google that's show or show some unnecessary ads.
Some apps in the Android are unnecessary permission are asking for access the apps.

 If you browse anything , seeing youtube videos,apps or whatever do in this android mobile.Whatever access in the Android mobile it's appear on my activity.It is closely watch your movements and save in my activity.So, if you don't want that to save my histories means Go to my activity - more - privacy,lock your privacy policies there or otherwise you can do it open new incognito tab and now kingdom of android mobile article coming soon........

The above content is not to harm anybody. If any mistakes, wrong facts and I'm not mentioned anything are share in the comment box.

Tuesday, 12 December 2017

Printing a matrix in spiral order(Spiral Matrix)

       In this post,We will see how to print a matrix in spiral format of clockwise direction.

If the matrix of 3×3 is  [1 2 3
                                           4 5 6
                                           7 8 9]
Then it is printed in spiral format in clockwise direction as , 1 2 3 6 9 8 7 4 5.

         
 If the matrix is of 4×4 or higher ,it should be printed in the following order.




                                
 -> First ,We should start from left to right direction. Where dir=0.

->  Then ,from top to bottom direction.
       Where dir=1.
->Then ,from right to left direction.Where 
    dir=2.
 
->Then ,from bottom to top.Where dir=3.

Here, the variable 'dir' is used to specify the direction.

->The variables  'T' (top) -> points 0th row.

->The variable 'B' (bottom)-> points to mth row.

->The variable 'L' (left)-> points to 0th column.

->The variable 'R' (right)-> points to nth column.


Program:

#include<iostream>
using namespace std;
int main()
{
   int Mat[10][10];
    int dir=0;
    int T,B,L,R;
    int m,n;
    cout<<"Give the order of the matrix"<<endl;
    cin>>m>>n;

    T=0;
    B=m-1;
    L=0;
    R=n-1;
    for(int i=0;i<m;i++)
        for(int j=0;j<n;j++)
            cin>>Mat[i][j];
    while(T<=B && L<=B)
    {
        if(dir==0)  
        {
            for(int k=L;k<=R;k++)
                cout<<Mat[T][k];
            T++;
        }
        if(dir==1)
        {
            for(int k=T;k<=B;k++)
                 cout<<Mat[k][R];
            R--;
        }
        if(dir==2)

        {
            for(int k=R;k>=L;k--)
                cout<<Mat[B][k];
            B--;
        }
        if(dir==3)
        {
            for(int k=B;k>=T;k--)
                cout<<Mat[k][L];
            L++;
        }
        dir=(dir+1)%4;
    }
}



Output:




HIDDEN FACTS - 00

             We start hidden facts series. In this series we discuss about hidden facts in this world.

what contents are in this series?
             In this series we discuss about entertainment, music, art,fashion, costumes, suggestions, stories, places, destroyed things, destroyable things, gadget, natural,food, tech news, cultures, leaders,human beings,automobiles ,animals, etc,. So, if you feel miss something means comment.Give your support.The respective articles are coming soon.......

Sunday, 10 December 2017

Pattern printing using asterix in shape of Q

     
   Pattern printing is to arrange the symbols.

In this program,I arranged the asterix symbol in the shape of Q.
Like the below,
            
                  ********
                  *             *
                  *             *
                  *             *
                  *         *  *
                  *           **
                  ********          
                                  *

 Program:

#include<iostream>
using namespace std;
int main()
{
    int i;
    for(i=0;i<=7;i++)
    {
        switch(i)
        {
            case 1:cout<<"******"<<endl;           break;
            case 2:cout<<"*       *"<<endl;break;
            case 3:cout<<"*       *"<<endl;break;
            case 4:cout<<"*    * *"<<endl;break;
            case 5:cout<<"*     **"<<endl;break;
            case 6:cout<<"******"<<endl;break;
            case 7:cout<<"           *"<<endl;break;
        }
    }
}

Sample outlet:


Alternate sorting


   Alternate sorting is a problem of testing the knowledge of using loops and conditional statements. 

Problem:

           Given an array of integers,rearrange the array in such a way that first element is 
first maximum and the second element is 
first minimum.
   Eg:
        Input:  1,2,3,4,5,6,7
        Output: 7,1,6,2,5,3,4

Program:


#include<iostream>
using namespace std;
int main()
{
    int arr[50],n,i,j;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    for(i=0;i<n-1;i++)
    {
        for(j=i;j<n;j++)
        {
            if(i%2==0)
            {
               if(arr[i]<arr[j])
                {
                    int temp=arr[i];
                    arr[i]=arr[j];
                    arr[j]=temp;
                }
            }
            else
            {
                if(arr[i]>arr[j])
                {
                     int temp=arr[i];
                      arr[i]=arr[j];
                      arr[j]=temp;
                }
            }
        }
    }
    for(i=0;i<n;i++)
    {
        cout<<arr[i]<<endl;
    }
}

Output:


Saturday, 9 December 2017

Array sorting based weight of elements

Problem:  Given a set of numbers like <10, 36, 54,89,12> we want to find sum of weights based on the following conditions

    1. 5 if a perfect square

    2. 4 if multiple of 4 and divisible by 6

    3. 3 if even number

And sort the numbers based on the weight and print it as follows

<10,its_weight>,<36,its weight><89,its weight>

Should display the numbers based on increasing order.

Program:

#include<iostream>
#include<math.h>
using namespace std;
bool even(int x);
bool divisible(int x);
bool perfectsqr(int x);
int main()
{
    int arr[5]={10,36,54,89,12};
    int sum[5],i,temp;
    for(i=0;i<5;i++)
    {
         sum[i]=0;
         if(perfectsqr(arr[i]))
                sum[i]=sum[i]+5;
         if(divisible(arr[i]))
                sum[i]=sum[i]+4;
         if(even(arr[i]))
                sum[i]=sum[i]+3;
       
    }
    for(i=0;i<4;i++)
    {
        for(int j=i;j<5;j++)
        {
            if(sum[i]<sum[j])
            {
                 temp=sum[i];
                 sum[i]=sum[j];
                 sum[j]=temp;
                 temp=arr[i];
                 arr[i]=arr[j];
                 arr[j]=temp;
            }
        }
    }
    for(i=0;i<5;i++)
    {
        cout<<"<"<<arr[i]<<","<<sum[i]<<">";
        if(i!=4)
        cout<<",";
    }
    return 0;
}
bool even(int x)
{
    if(x%2==0)
        return 1;
    else
        return 0;
}
bool divisible(int x)
{
    if(x%4==0 && x%6==0)
        return 1;
    else
        return 0;
}
bool perfectsqr(int x)
{
   int ires;
    float fres=sqrt(x);
    ires=fres;
    if(ires==fres)
        return 1;
    else
        return 0;
}
Sample output:



Friday, 8 December 2017

Pattern printing (in a single loop)


Problem:


               Print the following pattern.

                              P          m
                                r      a
                                  o  r
                                    g 
                                  o  r
                                r      a
                              P          m

Criteria:

        One single for loop should be used (or) thecomplexity of the program should be O(n).



#include<iostream>
using namespace std;
int main()
{
    char str[20]="Program";
    int i;
    for(i=0;i<10;i++)
    {
        char out[20]="          "; 
        out[i]=str[i];
        out[6-i]=str[6-i];
        cout<<out;
        cout<<"\n";
    }
    return 0;

}    

SaSample output:

mple output:


   




Monday, 4 December 2017

Finding immediate greater


In this post,I demonstrate a problem which is asked in zoho interviews.

So, i think tis will be usefull for the people who are preparing for their
job interviews.

Question:

Find immediate greater in an array

An array of 'n' elements is given,
immediate greater element for every element should be found in the array.

Input:
6 4 3 9 5

Output:
6->9 4->5 3->4 9-> 5->6


Algorithm:

1.Get the elements in an array.
2.Sort the elemens in the separate another array.
3.Take an element in unsorted array and find its position in
   sorted array and its next element is its immediate greater.
4.Do the same process for all elements.
5.If its positiion in sorted array is n-1,then it do not have
  any greater element to it.

Program:

#include<stdio.h>

#include<conio.h>
int arr[50],sort[50],n;
int search(int a);
void sorting();
void main()
{
int i,j;
clrscr();
printf("Enter no. of elements in the array\n");
scanf("%d",&n);
printf("Enter array elements\n");
for(i=0;i<n;i++)
      {
scanf("%d",&arr[i]);
sort[i]=arr[i];
       }
sorting();
for(i=0;i<n;i++)
{
j=search(arr[i]);
if(j+1==n){printf("%d->\t",arr[i]);}
else
printf("%d->%d\t",arr[i],sort[j+1]);
}
getch();
}
void sorting()
{
int i,j,temp;
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(sort[i]>sort[j])
    { temp=sort[i];
sort[i]=sort[j];
sort[j]=temp;
    }
}
}
return;
}
int search(int a)
{
int i;
for(i=0;i<n;i++)
{
if(a==sort[i])
return i;
}
}


Hope you understand the problem and the solution for it.
Any questions or complexity in explanation ask in comments.
                           Thank you.

Friday, 1 December 2017

Binary to decimal conversion using recursion


// CONVERSION OF BINARY TO DECIMAL USING RECURSION


/*PROCEDURE
   1.Eg:  Take a binary number as 1110
   2.1   1   1 0
       |    |    |    |->multiplyby2^0=result0
               |    |    |->multiply by 2^1  =result1
               |    |->multiply by 2^2  =result2
               |->multiply by 2^3  =result 3

  3.Final ,the converted decimal number=result0+result1+result2+result3

*/


#include<stdio.h>
#include<string.h>
#include<math.h>


int todecimal(char bin[50],int len);
int len; //Using ‘len’ as global variable is optional

void main()
{
char bin[50];
int dec;
clrscr();
printf("Enter the binary number\n");
scanf("%s",bin);
len=strlen(bin);
dec=todecimal(bin,len);
printf("%d",dec);
getch();
}
int todecimal(char bin[50],int l)
{
      if(len-l==len)
return 0;
      else
      {
   if(bin[len-l]=='0')
return todecimal(bin,l-1);
   else
return 1*pow(2,l-1)+todecimal(bin,l-1);
      }
}

Any doubts ask it in comments.
Finally share this program,if you like this.
                             Thank you.