Posts

Find gcd, lcm of given two numbers.

Image
 Hello, budding developers. As the title says it all. We will write a program to find the gcd and lcm of two given numbers. Editor used: CodeBlocks Language used: C++ Program: #include <iostream> using namespace std; int main() {     int n1,n2,gcd=0,lcm=0;    cout<<"Enter number 1:";    cin>>n1;    cout<<"\nEnter number 2:";    cin>>n2;      int mult=n1*n2;    while(n1!=n2)    {        if(n1>n2)        {            n1=n1-n2;            gcd=n1;        }        else        {            n2=n2-n1;      ...

Return smallest and largest number by rearranging digits.

Image
Hello, budding developers. As the topic says it all. We will write a program which will take 4 digits and rearrange those digits to give the smallest 4 digit and largest 4 digit number. It should be a valid 4 digit number eg.1000 and not 0001. Editor used: CodeBlocks Language used: C++ Program: #include<iostream> using namespace std; int main() { int arr[4],arr2[4]; int temp=0; cout<<"Enter 4 digits:\n"; for(int i=0;i<4;i++) { cin>>arr[i]; arr2[i]=arr[i]; } for(int i=0;i<4;i++) { for(int j=0;j<4-i;j++) { if(arr[j]>arr[j+1]) { temp=arr[j]; arr[j]=arr[j+1]; arr[j+1]=temp; }}} for(int i=0;i<4;i++) { for(int j=0;j<4-i;j++) { if(arr2[j]<arr2[j+1]) { temp=arr2[j]; arr2[j]=arr2[j+1]; arr2[j+1]=temp; }}} if(arr[0]==0) { temp=arr[0]; arr[0]=arr[1]; arr[1]=temp; } if(arr[0]==0 && arr[1]==0) { temp=arr[0]; arr[0]=arr[2]; arr[2]=temp; } if(arr[0]==0 && arr[1]==0 && arr[2]==0) { temp=arr[0]; arr[0]=arr[3]; arr[3]=temp; } cout...

Expense Manager or Expense Tracker app

Image
     Since it is our first blog, we'll begin with a basic app i.e., an expense manager app.  As the name suggests, the app will be used for keeping track of your expenses so that you can manage your earnings. Note: This project is built in Android Studio using Java and for backend we use SQLite. This is the preview of the application. To begin with we'll first design the layout. Source Code: activity_main.xml <? xml version ="1.0" encoding ="utf-8" ?> < androidx.constraintlayout.widget.ConstraintLayout xmlns: android ="http://schemas.android.com/apk/res/android" xmlns: app ="http://schemas.android.com/apk/res-auto" xmlns: tools ="http://schemas.android.com/tools" android :layout_width ="match_parent" android :layout_height ="match_parent" android :label ="@string/app_name" tools :context =".MainActivity" > < TableLayout ...