JoBat update

A Virtual World of Infotainment :)

Adam Number or Not

A number is said to be an Adam number if the reverse of the square of the number is equal to the square of the reversed number.for example 12 is a adam number because the reverse of the square of 12 is 144 which is 441 and square of the reverse of 12 is the square of the 21 which is also 441

Sample input : 12
Sample output : adam number
Sample input : 14
Sample output : not an adam number
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
    string num,rev;
    int sq_1,sq_2;
    cout<<"Enter the number ";
    cin>>num; //num=12
    rev=num;
    reverse(rev.begin(),rev.end()); //rev=21
    sq_1=stoi(num)*stoi(num); //stoi-string to integer //12*12=144
    sq_2=stoi(rev)*stoi(rev);//21*21=441
    num=to_string(sq_1); //convert number to string 
    rev=to_string(sq_2);
    reverse(rev.begin(),rev.end());//441-reversed to 144
    if(num==rev) //144==144
    {
        cout<<"Given number is an adam number";
    }
    else
    {
        cout<<"Given number is not an adam number";
    }
}

OUTPUT :

Compress a string

Write a program to compress the given string 

Sample input : aabbbccccddddd
Sample output : a2b3c4d5

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
    string a;
    int k=0,count=1,i=0,j,n;
    cout<<"Enter the string : ";
    cin>>a;
    n=a.size();
    cout<<"Compressed String : ";
    while(i<n)
    {
        
        for(j=k;j<n;j++)
        {
            if(a[j]==a[j+1])
            {
                count++;
                k=j+1;
            }
            else
            {
                k=j+1;
                break;
            }
        }
        i=k;
        cout<<a[i-1]<<count;
        count=1;
    }

    
}

OUTPUT:


N th minimum element in a array

To find the 'N' th minimum element in the given array

Sample input : array length : 5
                         array element : 10 5 3 8 15
                         nth element : 4
 Sample output : 10

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <stdio.h>
int main()
{
    int arr[10],i,j,n,temp,a,min;
    printf("enter the length of array : ");
    scanf("%d",&a);
    printf("enter the array elements : ");
    for(i=0;i<a;i++)
    {
        scanf("%d",&arr[i]);
    }
    printf("Enter the 'n'th min value to find : ");
    scanf("%d",&n);
   for(i=1;i<a;i++) //insertion sort
   {
       temp=arr[i];
       j=i-1;
       while (j>=0 && arr[j]>temp)
       {
           arr[j+1] = arr[j];
           j = j-1;
       }
       arr[j+1] = temp;
   }
    printf("the minimum element in the given pos in array is : %d",arr[n-1]);
    return 0;
}

OUTPUT:


The list of 65th National Award winners have been unfurled...

Village Rockstars grabbed the attention of many and late actress Sridevi got the Best Actress award!
Take Off, Baahubali 2, Bhayanakam, Irada, Walking with the Wind and Nagar Kirtan were the other notable names on the list.

Every field has multiple winners for various movies, but Music, an exception!

Both 'Best Music Direction' and 'Best Background Score' goes to 'Mozart of Madras' AR Rahman!!!
Best Music Direction for Mani Ratnam's Kaatru Veliyidai and Best Background Score for MOM!

When you take Kaatru Veliyidai and MOM, they failed to collect a huge out of Box office, yet they are musically rich!

Addictive Azhagiye,
Magical Vaan, 
Trippy Jugni,
Festive Saarattu,
SpanishTango,
And, Pleasing Nallai,
Made Kaatru Veliyidai, a breezy album!  


The Background score was handled by AR Rahman's talented Qutb-e-Kripa crew!
Here are some scenes, where the Background Score reached its zenith.,
  • Kargil War (Opening scene)
  • Snow Storm
  • At jail (remembering the past)
  • Van Chase after escape from jail
  • Traveling to nowhere (in search of love) and much more...
There was an Islamic touch throughout the sequences at Pakistan.
Certainly, the album topped the iTunes chart of Indian subcontinent!
AR Rahman got Shashaa Tirupati her first National Award for Best Female Playback Singer, for her beautiful rendition in 'Vaan Varuvaan'!
Only AR Rahman can pick up the best and bring out their best! (The best examples are Unnikrishnan, Shankar Mahadevan, Udit Narayan, Naresh Iyer, Shreya Ghoshal, etc.)

Coming to MOM,
  • 'Raakh Baaki' kickstarted (initial tune with "hey" chorus) in the opening scene at school, a perfect start to the film!
  • 'Freaking Life' was really freaky like it's name with a Party scene on the go.
  • The very next scene, where some strangers physically abuse Sridevi's daughter had a slow and horrific tune played at the background, that was quiet scary!
  • The scene, when Sridevi chases one of the rapists, started with a racy BGM and suddenly drops down, when Sridevi crashes with another vehicle. What a changeover!
  • When Sridevi goes to the homes of rapists secretly to plot their deaths, the music played at the backdrop of these scenes makes us feel nervous and sometimes jerks us off! 
  • It gives us a feel that, as if we are there at that place! 
  • An another scene, where Sridevi's daughter feels a sigh of relief (but unable to express her joy) after seeing the news of the death of one of the rapists (who spoiled her), the background score in this particular scene melted our hearts!
  • 'O Sona Tere Liye', sung by ARR was soulful, and a best fitting track to that particular situation, when Sridevi's family goes on a trip to overcome the disasters, the hard times of their lives! The song stirs the heart and brings a peace of mind!
  • The Climax scene, where the antagonist comes in search of Sridevi and her family to kill them had a different kind of horror tune, especially when Sridevi struggle to breathe (after her face was covered by the villain).


AR Rahman's experimental background score for MOM is well-deserved for the National Award!

The wait begins for the next Oscars for Beyond the Clouds...
Already, the album has become the #1 bestseller in Amazon!


#ARR #Ala_re_Ala #IsaiPuyal #EllaPugazhumIraivanukke 

Square Matrix-Corner Elements Sum

A square matrix of size N*N is passed as the input.The program must calculate and print the sum of the elements in the corners.
Sample Input:
Enter the order N of matrix : 3
Enter the matrix elements :
10 9 1
4 5 4
32 8 66
Sample Output:
109
Explanation:
sum = 10+1+32+66=109
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<stdio.h>
int main()
{
    int sum=0,a[10][10],i,j,n;
    printf("Enter the order N of matrix : ");
    scanf("%d",&n); //n*n matrix
    printf("Enter the matrix elements : ");
    for(i=0;i<n;i++)
    {
        for(j=0;j<n;j++)
        {
            scanf("%d",&a[i][j]);
        }
    }
    for(i=0;i<n;i++)
    {
        if((i==0)||(i==n-1)) //select only first and last row
        {
            for(j=0;j<n;j++)
            {
                if((j==0)||(j==n-1)) //select only first and last column 
                {
                    sum=sum+a[i][j];
                }
            }
        }
    }
    printf("%d",sum);
    return 0;
    
}

OUTPUT:


Palindrome Missing Alphabet 

String S which is a palindrome is passed as the input. But just one alphabet is missing in S.The program must print the missing alphabet A.
Note: The first alphabet of S will always be present.
Sample Input 1:
malayaam
Sample Output 1:
malayalam
missing character : l

Sample Input 2 :
abcddcb
Sample Output 2:
abcddcba
missing character : a

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
 char str[20],temp[20],cha;
 int count=0,i,j,len;
 clrscr();
 printf("enter the string : ");
 gets(str);
 strcpy(temp,str);
 strrev(temp);
 len=strlen(str);
 for(i=0;i<=len;i++)
 {
  if(str[i]==temp[i])    //if same elt is present in both the array
  {
  printf("%c",temp[i]);
  }
  else if(count>0)    //after insert the missing character 
  {              //print remaining character without going to else loop
  printf("%c",temp[i]);
  }
  else          //insert missing character
  {
   for(j=len-1;j>=i;j--)
   {
   temp[j+1]=temp[j];//before insert shift the character one pos right
   }
   temp[i]=str[i];      //insert character
   cha=temp[i];
   printf("%c",temp[i]);
   count=count+1;
  }
 }
 printf("\nmissing character : %c",cha);
 getch();
 return 0;
}

OUTPUT




Minimum Absolute Difference in an Array

Given an array of integers,find and print the minimum absolute difference between any two elements in the array. for example given the array A=[-2,2,4] we can create 3 pairs of numbers [-2,2],[-2,4] and [2,4].The difference for these pairs are 4,6 and 2 .The minimum absolute difference is 2.

Sample input :
3 //number of elements in array
3 -7 0
Sample output:
3
Explanation:
|3 - -7| = 10
|3-0| = 3
|-7-0|=7
minimum difference is 3.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <stdio.h>
int main()
{
    int a[10],i,j,diff,n,k; //number of elements in array
    int arr[10],count=0,m,min; //array contains all possible diff in an array
    printf("Enter the number of elements : ");
    scanf("%d",&n);
    printf("enter the array elements :");
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=0;i<n-1;i++)
    {
        k=i+1;
        for(j=k;j<n;j++)
        {
            diff=a[i]-a[j];
            arr[count]=abs(diff); //difference stored in second array
            count++;
        }
    }
    //find the smallest number in the second array 
    min=arr[0];
    for(m=1;m<count;m++)
    {
        if(arr[m]<min)
        {
            min=arr[m];
        }
    }
    printf("minimum absolute difference = %d",min);
    return 0;
}
OUTPUT:



Reverse vowels in a given string

         Given a string,task is to reverse the vowels of the string.
Sample Input 1:
jobat update
Sample Output 1:
jebat updato
Sample Input 2:
hello world
Sample Output 2:
hollo werld

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include<stdio.h>
#include<string.h>
int main()
{
    char a[20],b[20],t[20];
    int j=0,l,k,i;
    printf("Enter the string  ");
    gets(a);
    l=strlen(a);
    for(i=0;i<l;i++)
    {
        if((a[i]=='a')||(a[i]=='i')||(a[i]=='o')||(a[i]=='u')||(a[i]=='e'))
        {
            b[j]=a[i]; //vowels stored in another array
            j++;
        }
    }
    k=strlen(b);
    j=0;
    for(i=l-1;i>=0;i--)
    {
        if((a[i]=='a')||(a[i]=='i')||(a[i]=='o')||(a[i]=='u')||(a[i]=='e'))
        {
            a[i]=b[j];
            j++;
        }
    }
    printf("%s",a);
}

OUTPUT




Newer Posts Older Posts Home

SUBSCRIBE & FOLLOW

POPULAR POSTS

  • Compress a string
  • Adam Number
  • Fab Four
  • Vada Chennai Review
  • Middlewares in Express JS

Categories

  • Awards 4
  • Code 23
  • Review 16
  • sport 1
  • Tech 2
  • Update 14

Contact Form

Name

Email *

Message *

  • ►  2020 (1)
    • ►  July (1)
  • ►  2019 (7)
    • ►  October (1)
    • ►  July (1)
    • ►  February (1)
    • ►  January (4)
  • ▼  2018 (33)
    • ►  October (2)
    • ►  September (3)
    • ►  August (1)
    • ►  July (3)
    • ►  June (4)
    • ▼  April (8)
      • Adam Number
      • Compress a string
      • Nth minimum element in a array
      • And the National Award goes to...
      • Square Matrix-Corner Elements Sum
      • Palindrome Missing Alphabet
      • Minimum Absolute Difference in an Array
      • Reverse Vowels
    • ►  March (7)
    • ►  February (1)
    • ►  January (4)
  • ►  2017 (17)
    • ►  December (3)
    • ►  November (6)
    • ►  October (8)

Search This Blog

Powered by Blogger.

Report Abuse

HOME

  • HOME
  • Code Block
  • Tech World
  • How is it?
  • What's Up?
  • JoBatMovie_Awards
  • Sports Block
  • Privacy Policy

JoBatMovie Awards

  • Home
  • JoBatMovie Awards
  • Home

Featured post

JBM awards 2k18

JoBat Updates

Designed by OddThemes | Distributed by Gooyaabi Templates