Decimal to octal conversion

The following program takes a decimal number as an input and prints its octal equivalent. This program is implemented using c. Code: #include<stdio.h>int main(){ int n,a[100],i,j; printf(“Enter a decimal number : “); scanf(“%d”,&n); for (i=0;n!=0;i++) { a[i]=n%8; n=n/8; } printf(“The octal equivalent is : “); for (j=i-1;j>=0;j–) { printf(“%d”,a[j]); } return 0;} Output:

Read More

Binary Search Iterative method in python

This is an iterative method for the binary search algorithm. It takes a list as an input and another variable which is the data to be searched, and then passes them to the bin() function. And in bin() there is a single while loop. Screenshots/ Output : The Code def bin(x,y): l=0; h=len(x)-1; while(l<=h): mid=(l+h)/2 if(x[mid]<y): l=mid+1 elif(x[mid]>y): h=mid-1 elif(x[mid]==y): print “found ” break; else: print “Not Found “x=input()y=input()bin(x,y);

Read More

Create an app which can change Ringer mode through SMS

Its been a common problem for all people, specially the young generation to locate their mobile when it’s in Silent ringer mode. This app let you change your mobiles ringer mode through a SMS from some other mobile. Yes, you can trigger to general mode by just sending a HOT WORD from any mobile to your number. This app reads all your message and scans for that HOT WORD when found, performs operation with the AudioManager of your Android Smartphone. In this post, you will be guided how to create…

Read More

Build Simple Music Player With AlbumArt Support

This is a sample music player app which has play, pause and seek features. This is just a basic music player with a little customization. This type of app is suitable for mini projects. This basic music player also displays the default album art of the selected song. The app basically scans your whole External SD card recursively and add the songs to a Listview using a BaseAdapter class. Main Activity showing the list of Songs present in the SD Card.  M2Activity, Playing the song clicked on the Main Activity.…

Read More

Linear search

The following program takes a number as an input and checks whether that number is present in a group of elements or not. It takes linear time to execute. The program is implemented using c. #include<stdio.h>int main(){ int n; printf(“Enter number of elements of the group : “); scanf(“%d”,&n); int a[n],m,i; for(i=0;i<n;i++) scanf(“%d”,&a[i]); printf(“nEnter a element for searching : “); scanf(“%d”,&m); for(i=0;i<n;i++) { if(m==a[i]) { printf(“%d found in %d position.”,m,i+1); break; } } return 0;} Description : In the above program the group of elements are stored using array. Then…

Read More

Bubble Sort

The below program takes an array as an input and prints the elements of the array in sorted order. Adjacent elements are checked in this sorting method. The program is implemented using c. #include<stdio.h>int main(){ int temp,i,n,j; printf(“nEnter number of elements that are to be sorted : “); scanf(“%d”,&n); int a[n]; for(i=0;i<n;i++) scanf(“%d”,&a[i]); for(i=n-1;i>=0;i–) for(j=1;j<=i;j++) if(a[j-1]>a[j]) { temp=a[j-1]; a[j-1]=a[j]; a[j]=temp; } printf(“The elements in sorted order are :”); for(i=0;i<n;i++) printf(“%d “,a[i]);} Description: The above program sorts the given array and prints it. The adjacent elements are checked whether the two…

Read More