HOME

Monday, May 18, 2015

TO DISPLAY NUMBER OF OCCURRENCE OF LETTER OF GIVEN STRING

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
    char string[50];
    int count[26],i,j=0,alpha[26],m;
    char letter=97;
    printf("enter the string\n");
    gets(string);
    strlwr(string);
    for(m=0;m<26;m++)
    {
        count[m]=0;
        i=0;
    while(string[i]!=NULL)
    {
        alpha[m]=letter;
        if(alpha[m]==string[i])
        {
            count[m]++;
        }
        i++;
    }
    letter++;
    }
    printf("\nalphabet\t\t\toccurrence\n");
    for(m=0;m<26;m++)
    {
        if(count[m]!=0)
        {
            printf("%c\t\t\t\t%d\n",alpha[m],count[m]);
        }
    }
}

Monday, May 4, 2015

8085 MPU PROGRAM TO PERFORM EXPRESSION DAH-(59H+44H)

MVI A 59h
MVI B 44h
ADD B
DAA
MOV C A
MVI A DAh
SBB C
DAA
STA 3000h

8085 MPU PROGRAM TO PERFORM 16 ADDITION USING 8 BIT METHOD

LXI H 5492h
XCHG
LXI H A5B6h
MOV A L
ADD E
STA 1001h
MOV A H
ADC D
STA 1000h

Please kindly create a 1000h and 1001h address in user grid  so that result can be store in it.

8085 MPU PROGRAM TO MULTIPLY 17H AND 04 AND AND STORE RESULT IN 2000H ADDRESS

MVI A 00h
MVI C 04h
MVI B 17h
LOOP: ADC B
DAA
DCR C
JNZ LOOP
STA 2000h
HLT

Please kindly create a 2000h address in user grid table so that result will be store in 2000h address

8085 MPU PROGRAM TO SOLVE THE EXPRESSION A7H-83H+17H AND STORE RESULT IN 2000H ADDRESS

MVI A A7h
MVI B 83h
MVI C 17h
SUB B
DAA
ADC C
DAA
STA 2000h

Please create the address 2000h in usergrid so that it can store the result in 2000h address

8085 MPU PROGRAM TO EXCHANGE THE VALUE OF TWO REGISTER USING SUBROUTINE CONCEPT

MVI B 05h
MVI C 08h
CALL SWAP
HLT
SWAP: MOV D B
MOV B C
MOV C D
RET

8085 MPU PROGRAM TO FIND THE SMALLEST NUMBER FROM GIVEN ARRAY ELEMENT

LXI H 1000h
MVI C 05h
MOV A M
LOOP: INX H
CMP M
JC SMALLEST
MOV A M
SMALLEST: DCR C
JNZ LOOP
STA 2000h
HLT

Please fill the usergrid which is starting from 1000h to 1006h and input the value to find the smallest number from the given value and don't forget to make 2000h location also so, that smallest number will be store in 2000h location.

8085 MPU PROGRAM TO FIND LARGEST NUMBER FROM GIVEN ARRAY ELEMENT

LXI H 1000h
MVI C 05h
MOV A M
LOOP: INX H
CMP M
JNC GREATER
MOV A M
GREATER: DCR C
JNZ LOOP
STA 2000h
HLT

Please fill the user grid which begin from 1000h to 1006h and insert the value to find the largest number.

Sunday, May 3, 2015

SORTING OF STRING IN ASCENDING ORDER USING C PROGRAM

#include<stdio.h>
#include<conio.h>
void main()
{
    char name[10][20],temp[20];
    int i,j,n;
    printf("how many string you want to enter\n");
    scanf("%d",&n);
    printf("enter the strings\n");
    for(i=0;i<=n;i++)
    {
gets(name[i]);
strlwr(name[i]);
  }
    for(i=0;i<n;i++)
    {
        for(j=0;j<n;j++)
        {
         if((strcmp(name[j],name[j+1])==1))
            {
                strcpy(temp,name[j]);
                strcpy(name[j],name[j+1]);
                strcpy(name[j+1],temp);
            }
        }

    }
    printf("sorted form of data are:\n");
    for(i=0;i<=n;i++)
    {
        printf("%s\n",name[i]);
    }



}

C PROGRAM TO REVERSE THE NUMBER

#include<stdio.h>
#include<conio.h>
void main()
{
    int n,rem,rev=0;
    printf("enter the number\n");
    scanf("%d",&n);
    while(n>0)
    {
        rem=n%10;
        rev=rev*10+rem;
        n=n/10;
    }
    printf("the reverse of the number is %d",rev);
}

C PROGRAM TO DELETE NUMBER FROM IT LOCATION IN ARRAY

#include<stdio.h>
#include<conio.h>
void main()
{
 int a[]={1,2,4,5,6,74,32};
 int position,i;
 printf("the number are:\n");
 for(i=0;i<7;i++)
 {
     printf("%d\t",a[i]);
 }
 printf("\nenter the position to delete\n");
 scanf("%d",&position);
 for(i=position;i<=7;i++)
 {
     a[i-1]=a[i];
 }
 printf("\nthe data after deletion is:\n");
 for(i=0;i<6;i++)
 {
     printf("%d\t",a[i]);
 }
}

C PROGRAM TO PRINT PRIME NUMBER BETWEEN 1 TO 500

#include<stdio.h>
#include<conio.h>
void main()
{
    int i,j,c;
    for(i=1;i<=500;i++)
    {
        c=0;
        for(j=1;j<=i;j++)
        {
            if(i%j==0)
            {
                c++;
            }
    }
    if(c==2)
            {
                printf("%d\t",i);
            }
}
}