Posts

Image
C-PROGRAMHEAP SORT
#include<stdio.h> #include<stdlib.h> void heapify1(int *a, int lim) {int i,j,tmp,left,right,fg=0; i=1; while(fg==0){ left=2*i; right=(2*i)+1; if(right<=lim) { if(a[i]<a[left] || a[i]< a[right]){ if(a[left]>a[right]){ tmp=a[left]; a[left]=a[i]; a[i]=tmp; i=left; } else { tmp=a[right]; a[right]=a[i]; a[i]=tmp; i=right; }} else {fg=1;} }else if (left<=lim){ if(a[left]>a[i]){ tmp=a[left]; a[left]=a[i]; a[i]=tmp; i=left; } else{ fg=1; } }// end of left<=lim else{ //pri…
Image
C-PROGRAMLINKED LIST
#include<stdlib.h>
#include<stdio.h>
struct node
{
int a;
struct node *next;
};
void display(struct node *temp)
{
printf("\n elements in the list are\n");
while(temp!=NULL)
{
printf("\t %d",temp->a);
temp=temp->next;
}
}
struct node *insert(struct node *start)
{
struct node *temp,*prev;
int pos;
temp=(struct node*)malloc(sizeof(struct node));
printf("enter the number of elements");
scanf("%d",&temp->a);
printf("select the position to insert the number\n1.at the begning\n2.at the end\n3.at specified position");
scanf("%d",&pos);
switch(pos)
{
case 1:temp->next=start;
start=temp;
break;
case 2:prev=start;
while(prev->next!=NULL)
{
prev=prev->next;}
prev->next=temp;
temp->next=NULL;

break;
case 3:
printf("enter the position");
scanf("%d",&pos);
C tutorial video for beginners

if(pos==1)
{
temp->next=start;
start=temp;
}
else if(pos>1)
{
prev=start;
pos--;
while(pos>1 &&…
Image
C-PROGRAMQueue- enqueue and dequeue
#include<stdio.h>
void main()
{
int a[10],front=0,rear=0,ch,i;
do
{
printf("QUEUE OPERATIONS\n\t1.Enqueue\n\t2.Dequeue\n\t3.Display\nEnter your choice: ");
scanf("%d",&ch);
switch(ch)
{
case 1:
if(rear==10)
printf("Queue is already full: ");
else
{
printf("Enter an element: ");
scanf("%d",&a[rear++]);
}
break;
C tutorial video for beginners

case 2:
if(rear==0)
printf("Queue is empty: ");
else
printf("Deleted element is %d",a[front]);
for(i=0;i<rear;i++)
a[i]=a[i+1];
rear--;
break;
case 3:
if(rear==0)
printf("Queue is empty: ");
else
{
printf("Elements are \n");
for(i=0;i<rear;i++)
printf("%d ",a[i]);
}
break;
default:
printf("Invalid entry: ");
}
printf("\nPress (1) to continue: ");
scanf("%d",&ch);
}
while(ch==1);
}
C Tutorial For beginners



FREE ZONE TUTOR.................................YOUR FEEDBACK IS OUR KEY TO SUCCESS..........FRE…
Image
C-PROGRAMPROGRAM TO CHECK WHETHER ENTERED YEAR IS LEAP YEAR
#include<stdio.h>
void main()
{
int a;
printf("enter the year to be checked");
scanf("%d",&a);
if(a%4==0)
{
if(a%100==0)
{
if(a%400==0)
printf("Leap year");
C tutorial video for beginners

else
printf("Not a leap year ");
}
else
printf("Leap year");
}
else
printf("Not a leap year");
}
C Tutorial For beginners



FREE ZONE TUTOR.................................YOUR FEEDBACK IS OUR KEY TO SUCCESS..........FREE ZONE TUTOR.................................YOUR FEEDBACK IS OUR KEY TO SUCCESS...
Image
C-PROGRAMSTACK-push & pop operation
#include<stdio.h>
void main()
{
int a[10],it,c,i,fr=0;
do
{
printf("STACK \n 1.PUSH\n2.POP\n3.DISPLAY\nENTER YOUR CHOICE:");
scanf("%d",&c);
switch(c)
{
case 1:
if(fr<=9)
{
printf("enter the element");
scanf("%d",&it);
a[fr++]=it;
}
else
printf("stack overflow");
break;
C tutorial video for beginners

case 2:

if(fr>=0)
{
printf("the deleted item is %d",a[fr-1]);
--fr;
}
else
printf("stack is empty");
break;
case 3:
for(i=0;i<fr;i++)
printf("%d",a[fr]);
break;
default:
printf("invalid operation");
}
printf("press 1 to continue");
scanf("%d",&c);
}while(c==1);
}
C Tutorial For beginners



FREE ZONE TUTOR.................................YOUR FEEDBACK IS OUR KEY TO SUCCESS..........FREE ZONE TUTOR.................................YOUR FEEDBACK IS OUR KEY TO SUCCESS...
LINEAR SEARCH IN AN ARRAYAboutProjects Tutorial Videos #include<stdio.h>
void main()
{
int a[10],i,j,n,count=0;
printf("enter the array limit:\n");
scanf("%d",&n);
printf("enter the array elemants:\n");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]==a[j])
{
count=count+1;
}
}
printf("%d repeats %d times\n",a[i],count);
}

}

FREE ZONE TUTOR.................................YOUR FEEDBACK IS OUR KEY TO SUCCESS..........FREE ZONE TUTOR.................................YOUR FEEDBACK IS OUR KEY TO SUCCESS...
Image
STRING MANIPULATION STRING MANIPULATIONAboutProjects Tutorial Videos
#include<stdio.h>
int leng(char s1[10])
{
int count=0,i=0;
while(s1[i]!='\0')
{
count++;
i++;
}
return(count);
}
void con(char s1[10],char s2[10])
{
char s[20];
int l1,l2,i,j=0;
l1=leng(s1);
l2=leng(s2);
for(i=0;i<l1;i++)
{
s[i]=s1[i];
}
for(i=l1;i<l2+l1;i++)
{
s[i]=s2[j];
j++;
}
printf("--------------------------------------------\n THE CONCATINATED RESULT OF THE ENTERED STRING IS : \n %s\n----------------------------------------\n",s);

}
void rev(char s1[10])
{
int l1,l2,i,j;
char temp;
l1=leng(s1);
l1--;
j=l1/2;
for(i=0;i<=j;i++)
{
temp=s1[i];
s1[i]=s1[l1-i];
s1[l1-i]=temp;
}
printf("-----------------------------------------------THE REVERSE OF THE ENTERD STRING IS: \n %s \n -----------------------------------------------------\n",s1);
}
void main()
{
char s1[10],s2[10];
int ch,l,y;
do
{
printf("\t \t \t STRING MANIPULATION \n");
printf("\n\t \tSELECT THE OPERATION TO BE PERFORMED \n1.CONCATIN…