Monday, April 30, 2018

How to convert Decimal to Binary using Array Number System Part 3

#include<stdio.h>
main()
{
    int n,i=0,j,base=2;
    int bin[100];
    scanf("%d",&n);
    while(n!=0)
    {
        bin[i++]=n%base;
        n=n/base;
    }
    for(j=i-1;j>=0;j--){
        printf("%d",bin[j]);
    }
}

Sunday, April 29, 2018

How to convert Decimal to Binary_Most_Basic_(Number_System_Part_1)

#include<stdio.h>
main()
{
    int n,rem,bin=0,k=1;
    printf("Enter a decimal number ");
    scanf("%d",&n);
    while(n!=0)
    {
        rem=n%2;
        bin=bin+rem*k;
        k=k*10;
        n=n/2;

    }
    printf("Binary = %d\n",bin);

}

Monday, February 19, 2018

Java Swing Radio Button video tutorial in netbeans by Abdullah Bin Ubaidullah

Java Swing Radio Button example:


Output:
Code
here is output


Source code:

 private void showRadioBtnExampleActionPerformed(java.awt.event.ActionEvent evt) {                                                    
        maleRadioBtn.setActionCommand("Male");
        feMaleRadioBtn.setActionCommand("Female");
        JOptionPane.showMessageDialog(null,"You have selected "+buttonGroupGender.getSelection().getActionCommand());
        
    }

Watch Video Here:



Friday, November 24, 2017

Check two string weather they are same or not

///Check 2 string weather they are same or not
#include<stdio.h>
void main()
{
    int i,light=0;
    char s1[100],s2[100];
    gets(s1);///we
    gets(s2);///are
    if(strlen(s1)!=strlen(s2))
        printf("not same \n");
    else
    {
        for(i=0;s1[i]!=NULL;i++)
        {
            if(s1[i]!=s2[i])
            {
                light=1;
                break;
            }
        }
        if(light==1) printf("not same");
        else if(light==0)printf("same");
    }
}

Check Palindrome

Check Palindrome :

#include<stdio.h>
void main()
{
    int i,light=0;
    char s1[100],s2[100];
    gets(s1);///we
    strcpy(s2,s1);
    strrev(s2);///s2=ew
    if(strlen(s1)!=strlen(s2))
        printf("not palindrome \n");
    else
    {
        for(i=0;s1[i]!=NULL;i++)
        {
            if(s1[i]!=s2[i])
            {
                light=1;
                break;
            }
        }
        if(light==1) printf("not palindrome");
        else if(light==0)printf("palindrome");

    }
}

Tuesday, April 4, 2017

Structure using Array(students Information)

#include<stdio.h>

struct anything ///44 B
{
    int age;    ///4 B
    char name[20]; ///20 B           ///member definition
    char dept[10];///20 B

};

typedef struct anything newType ;



main()
{
    printf("Enter student number ");
    int num;
    scanf("%d",&num);
    newType student[num];
    int i;
    for(i=0 ; i<num ; i++)
    {
        printf("         Info of student %d : \n",i+1);

        printf("Name = ");
        getchar();
        gets(student[i].name);
        printf("Age = ");
        scanf("%d",&student[i].age);
        printf("Dept = ");
        getchar();
        gets(student[i].dept);
    }



    for(i=0 ; i<num ; i++)
    {
        printf("         Info of student %d : \n",i+1);

        printf("Name = ");
        puts(student[i].name);
        printf("Age  = %d\n",student[i].age);
        printf("Dept = ");
        puts(student[i].dept);
    }



}