EmbLogic's Blog

Category Archives: Data Structures with C

Swapping without third variable

#include<stdio.h> int main() { int i,j; printf(“Enter the value of i:”); scanf(“%d”,&i); printf(“Enter the value of j:”); scanf(“%d”,&j); i=i+j; j=i-j; i=i-j; printf(“%d”,i); printf(“%d”,j); return 0; }

Posted in Data Structures with C | Leave a comment

To find Largest and Smallest no.s among five numbers entered from the user

#include<stdio.h> int main() { int a,b,c,d,e,largest,smallest; printf(“enter five integers\n”); scanf(“%d%d%d%d%d”, &a,&b,&c,&d,&e); largest = a; if (b > largest) { largest=b; } if (c > largest) { largest=c; } if (d > largest) { largest=d; } if (e > largest) { … Continue reading

Posted in Data Structures with C | Leave a comment

Successfully found largest and smallest element of array using pointers.

RCS file: 04.c,v Working file: 04.c head: 1.2 branch: locks: strict root: 1.2 access list: symbolic names: keyword substitution: kv total revisions: 2; selected revisions: 2 description: This is the base file for our program…. —————————- revision 1.2 locked by: … Continue reading

Posted in Data Structures with C | Leave a comment

C program to sort n number of string.

#include #include int main() { int b; int i=0,j=0,k=0; char *a[10],c,*temp; printf(“How many string you want to enter:”); scanf(“%d”,&b); for(i=0;i<b;i++) { a[i]=(char*)malloc(sizeof(char)*20); } printf("Enter %d strings\n",b); for(i=0;i<b;i++) { scanf("%s",a[i]); } //Algorithm to sort string for(k=0;k<b;k++) { for(i=0;i(*(*(a+i+1)+j))) { temp=*(a+i); *(a+i)=*(a+i+1); … Continue reading

Posted in Data Structures with C | Leave a comment

Area of square & triangle

RCS file: area.c,v Working file: area.c head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: —————————- revision 1.1 locked by: root; date: 2015/02/21 06:35:32; author: root; state: Exp; … Continue reading

Posted in Data Structures with C | Leave a comment

Finding out largest number & the smallest number.

RCS file: largest.c,v Working file: largest.c head: 1.2 branch: locks: strict root: 1.2 access list: symbolic names: keyword substitution: kv total revisions: 2; selected revisions: 2 description: this is abt —————————- revision 1.2 locked by: root; date: 2015/02/20 08:50:26; author: … Continue reading

Posted in Data Structures with C | Leave a comment

value of resistor color code using switch statement

#include<stdio.h> int main() { char i; printf(“Enter the value of i”); scanf(“%c”,&i); switch(i) { case ’0′: printf(“Black”); break; case ’1′: printf(“brown”); break; case ’2′: printf(“Red”); break; case ’3′: printf(“Orange”); break; case ’4′: printf(“Yellow”); break; case ’5′: printf(“Green”); break; case ’6′: … Continue reading

Posted in Data Structures with C, Uncategorized | Leave a comment

Circular Queue Empty and Full condition check algo

1. Create a Queue. 2. In write function if(rp is less than fp) { write; increment rp; if(rp==fp) printf(“queue full”); } 3.In read function if(rp is greater than fp) { read; increment fp; if(rp == fp) printf(“queue empty”); }

Posted in Data Structures with C | Leave a comment

linked list- create node,Insert node(begining,end,nth position,key value),Traverse ,Delete(at begining,end,nth postion, key value))

RCS file: lgen.c,v Working file: lgen.c head: 1.27 branch: locks: strict root: 1.27 access list: symbolic names: keyword substitution: kv total revisions: 27; selected revisions: 27 description: A generalised program of linked list —————————- revision 1.27 locked by: root; date: … Continue reading

Posted in Data Structures with C | Leave a comment

C assignment no. 14

RCS file: 1.c,v Working file: 1.c head: 1.2 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 2; selected revisions: 2 description: STRUCTURE ASSIGNMENT —————————- revision 1.2 date: 2014/09/27 00:30:59; author: root; state: Exp; lines: +1 -1 … Continue reading

Posted in Data Structures with C | Leave a comment

C assignment no. 8

RCS file: 1.c,v Working file: 1.c head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: understand the basic pointer concepts understand that pointer stores a logical address in … Continue reading

Posted in Data Structures with C | Leave a comment

C assignment no. 7

RCS file: 1.c,v Working file: 1.c head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: understand array concept by getting input in array and displaying on terminal —————————- … Continue reading

Posted in Data Structures with C | Leave a comment

C assignment no. 6

RCS file: 1.c,v Working file: 1.c head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: do practice of while,for loop —————————- revision 1.1 locked by: root; date: 2014/10/29 … Continue reading

Posted in Data Structures with C | Leave a comment

C assignment no .5

RCS file: 1.c,v Working file: 1.c head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: understand the concept behind if(y0)x=3; else x=5; and if(z=(y==0))x=5; and if(x=y=z)x=3; this is … Continue reading

Posted in Data Structures with C | Leave a comment

C assignment no.4

RCS file: 1.c,v Working file: 1.c head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: use of if-else statement to determine a number wheather it is postive or … Continue reading

Posted in Data Structures with C | Leave a comment