13 July 2014

C programs to create pyramid structures

Q1.  Write a C program to create pyramid structure as shown below :

1
1 2
1 2 3
1 2 3 4
1 2 3 4 5


Code:
 //Author : Lakshmikant A. Deshpande  
 #include<stdio.h>  
 #include<stdlib.h>  
 void main()  
 {  
      int i=1,j=5;  
      for(i=1;i<=5;i++)  
      {  
           for(j=1;j<=i;j++)  
                printf("%d ",j);  
      printf("\n");  
      }  
 }  


Q2.  Write a C program to create pyramid structure as shown below :

    1  
   1 2  
  1 2 3
 1 2 3 4
1 2 3 4 5


Code:
 //Author : Lakshmikant A. Deshpande  
 #include<stdio.h>  
 #include<stdlib.h>  
 void main()  
 {  
      int spaces=4;  
      int i,j,k;  
      for(i=1;i<=5;i++)  
      {  
           for(k=0;k<spaces;k++)  //Print spaces
                printf(" ");  
           for(j=1;j<=i;j++)  
           {  
                printf("%d ",j);  
           }  
           for(k=0;k<spaces;k++)  //Print spaces
                printf(" ");  
           printf("\n");  
           spaces--;  
      }  
 }  

18 June 2014

Android KitKat (4.4) features, tips & tricks


Android KitKat is the most recent version of Android till date. It has revamped user interface with smoother animation and lower system hardware requirements. As Android rolled out Android KitKat, it introduced a bunch of new features and modifications in the Android API.

1. Keep mobile data under control
We use mobile data everyday. But not all of the carriers do have unlimited data plans. Sometimes we fail to keep an eye on mobile data limit and get a huge bill in return. And as we all know, Android applications hog data a lot because of cloud computing with synchronization.
Thanks to Android's built in data monitor which warns you to turn off data when warning limit set by you is exceeded, and turns off data automatically when data plan is exhausted. The data usage monitor even allows to reset the data counter on a particular date.

2. Keep an eye on alarms
Alarms are extremely useful for the most of us. But sometimes they make you feel awkward when your phone rings with an embarrassing alarm tone during meetings. KitKat dev team has kept this in mind and added an option to alert us about the upcoming alarm an hour before the alarm is supposed to ring. There will be a notification in tray to quickly dismiss the alarm.

3. Wireless print outs
Printing by connecting your phone to PC is a hassle. Android has got the HP's cloud printing plugin which can print the documents on the go without need of a cable. And as we can guess, only a few HP printers are supported with this plugin. It's a very useful feature.

4. Security promised
Google knows that we are forgetful and we forget our phones at places ;) So this new version of Android has been equipped with Android Device Manager, a service to track down your lost devices. The service ensures safety of our data and even allows to remotely locate, wipe, ring or lock the phone.
As you can guess, the service needs our location constantly, to keep track of places we've been visiting everyday. This location information is synced automatically. But for using this service we must enable Android Device Manager in following way :
     a. Go to 'Google Settings' app on phone
     b. Touch 'Android Device Manager'
     c. Tick on 'Allow remote lock and erase'
     d. Touch on 'Activate'. Now, your phone and the data is safe.

5. Next-Gen ART Runtime
Before KitKat, Android used to use Dalvik runtime which is basically a runtime virtual machine. But for KitKat, Android team has done some serious research, and developed a new runtime
known as ART, which is supposedly going to be used in next major Android version. ART has introduced improved garbage collection technology which improves application's responsiveness. ART supports ahead of time compilation which integrates install time verification. This means your apps will take more time and space to install, but they will provide faster experience than Dalvik would provide.
The feature has been disabled by default and can be enabled through developer options. To know how to enable developer options, you can go through this tutorial.
The feature can be enabled in Settings > Developer Options > Select Runtime > Use ART