LAB MANUAL
FOR
DATA STRUCTURE
USING C
Prepared by,
Sunita Debbarma
Lecturer
Computer Science & Technology Department
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY
WOMEN’S POLYTECHNIC
HAPANIA, AGARTALA, TRIPURA WEST – 799130, INDIA
, Lab manual for Data Structure using C Prepared by: Sunita Debbarma
1.
Aim: To display fibounacci series up to a range.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,n;
clrscr();
printf("\nEnter range:");
scanf("%d",&n);
a=0,b=1,c=0;
printf("%d \t %d",a,b);
c=a+b;
while(c<=n)
{
printf("\t%d",c);
a=b;
b=c;
c=a+b;
}
getch();
}
Output:
2.
Aim: To read n numbers and display it.
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n, a[10];
clrscr();
printf(“\nEnter the number of element : \n”);
scanf(“%d”,&n);
2
rd
3 Semester Diploma in Computer Science & Technology and Diploma in Information Technology
FOR
DATA STRUCTURE
USING C
Prepared by,
Sunita Debbarma
Lecturer
Computer Science & Technology Department
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY
WOMEN’S POLYTECHNIC
HAPANIA, AGARTALA, TRIPURA WEST – 799130, INDIA
, Lab manual for Data Structure using C Prepared by: Sunita Debbarma
1.
Aim: To display fibounacci series up to a range.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,n;
clrscr();
printf("\nEnter range:");
scanf("%d",&n);
a=0,b=1,c=0;
printf("%d \t %d",a,b);
c=a+b;
while(c<=n)
{
printf("\t%d",c);
a=b;
b=c;
c=a+b;
}
getch();
}
Output:
2.
Aim: To read n numbers and display it.
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n, a[10];
clrscr();
printf(“\nEnter the number of element : \n”);
scanf(“%d”,&n);
2
rd
3 Semester Diploma in Computer Science & Technology and Diploma in Information Technology