SlideShare a Scribd company logo
//Array operation in C languages.
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
void main()
{
int a[10];
int i,c;
int n;
clrscr();
printf("How many values u want to store: ");
scanf("%d",&n);
printf("Enter the elements");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
while(1)
{
printf("Enter ur choice: n1.Insertionn2.Deletionn3.sortingn4.Searchn5.Displayn6.Exit ");
scanf("%d",&c);
switch(c)
{
case 1:
{
int p,item;
clrscr();
printf("nEnter the element");
scanf("%d",&item);
printf("nEnter the position where u want to insert: ");
scanf("%d",&p);
for(i=n;i>=p;i--)
a[i]=a[i-1];
a[p-1]=item;
n++;
printf("Element inserted successfully");
break;
}
case 2:{
int p;
clrscr();
printf("nthe elements are");
for(i=0;i<n;i++)
printf("%dt",a[i]);
printf("nEnter the position where u want to delete: ");
scanf("%d",&p);
for(i=p;i<n;i++)
a[i-1]=a[i];
n--;
printf("Element deleted successfully");
break;
}
case 3:
{
int i,j,t;
for(i=0;i<n-1;i++)
for(j=0;j<n-i;j++)
{
if(a[j]>a[j+1])
{
t=a[j+1];
a[j+1]=a[j] ;
a[j]=t;
}
}
printf("Element are sorted Successfully.");
break;
}
case 4:{
int item,k=0;
clrscr();
printf("Enter the element u want to search: ");
scanf("%d",&item);
for(i=0;i<n;i++)
{
if(a[i]==item)
{
k=i+1;
printf("Element is found at %d location",k);
}
else
{
i++;
}
}
if(k==0)
{
printf("Element is not found");
}
break;
}
case 5:{
printf("The value of n=%d",n);
printf("nthe elements are");
for(i=0;i<n;i++)
printf("%dt",a[i]);
break;
}
case 6:
exit(0);
}
}
}

More Related Content

What's hot (20)

PDF
Bcsl 033 data and file structures lab s5-2
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s5-3
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s3-3
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s3-1
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s2-2
Dr. Loganathan R
 
DOCX
8.1
namthip2539
 
PDF
12 1 문자열
Changwon National University
 
DOCX
New microsoft word document
Abhishek Arya
 
DOCX
C program to implement linked list using array abstract data type
loyola ICAM college of engineering and technology
 
DOCX
Circular queue
ShobhaHiremath8
 
PDF
C Programming Example
PRATHAMESH DESHPANDE
 
PPTX
C Programming Example
University of Potsdam
 
Bcsl 033 data and file structures lab s5-2
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s5-3
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s3-3
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s3-1
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s2-2
Dr. Loganathan R
 
New microsoft word document
Abhishek Arya
 
C program to implement linked list using array abstract data type
loyola ICAM college of engineering and technology
 
Circular queue
ShobhaHiremath8
 
C Programming Example
PRATHAMESH DESHPANDE
 
C Programming Example
University of Potsdam
 

Similar to One dimensional operation of Array in C- language (20)

DOC
C basics
MSc CST
 
PDF
C programms
Mukund Gandrakota
 
PDF
Data Structure using C
Bilal Mirza
 
DOCX
SaraPIC
Sara Sahu
 
DOCX
C lab manaual
manoj11manu
 
DOC
Basic c programs updated on 31.8.2020
vrgokila
 
DOCX
Chapter 8 c solution
Azhar Javed
 
PPTX
Introduction to Basic C programming 02
Wingston
 
DOCX
Data structure output 1
Balaji Thala
 
DOCX
cpract.docx
PRATIKSHABHOYAR6
 
DOCX
DataStructures notes
Lakshmi Sarvani Videla
 
DOCX
ADA FILE
Gaurav Singh
 
DOCX
C Programming
Sumant Diwakar
 
DOC
'C' language notes (a.p)
Ashishchinu
 
DOCX
DAA Lab File C Programs
Kandarp Tiwari
 
DOCX
Practical write a c program to reverse a given number
Mainak Sasmal
 
DOCX
Practical write a c program to reverse a given number
Mainak Sasmal
 
PPT
All important c programby makhan kumbhkar
sandeep kumbhkar
 
PPTX
Double linked list
Sayantan Sur
 
DOCX
Cpds lab
praveennallavelly08
 
C basics
MSc CST
 
C programms
Mukund Gandrakota
 
Data Structure using C
Bilal Mirza
 
SaraPIC
Sara Sahu
 
C lab manaual
manoj11manu
 
Basic c programs updated on 31.8.2020
vrgokila
 
Chapter 8 c solution
Azhar Javed
 
Introduction to Basic C programming 02
Wingston
 
Data structure output 1
Balaji Thala
 
cpract.docx
PRATIKSHABHOYAR6
 
DataStructures notes
Lakshmi Sarvani Videla
 
ADA FILE
Gaurav Singh
 
C Programming
Sumant Diwakar
 
'C' language notes (a.p)
Ashishchinu
 
DAA Lab File C Programs
Kandarp Tiwari
 
Practical write a c program to reverse a given number
Mainak Sasmal
 
Practical write a c program to reverse a given number
Mainak Sasmal
 
All important c programby makhan kumbhkar
sandeep kumbhkar
 
Double linked list
Sayantan Sur
 
Ad

Recently uploaded (20)

PDF
Halide Perovskites’ Multifunctional Properties: Coordination Engineering, Coo...
TaameBerhe2
 
PPTX
Product Development & DevelopmentLecture02.pptx
zeeshanwazir2
 
PPTX
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
PDF
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
PPTX
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
PPTX
MATLAB : Introduction , Features , Display Windows, Syntax, Operators, Graph...
Amity University, Patna
 
PDF
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
JappanMavani
 
PPTX
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 
PPTX
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
PPTX
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
PDF
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
PDF
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
PPTX
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
PPTX
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
PPTX
What is Shot Peening | Shot Peening is a Surface Treatment Process
Vibra Finish
 
PPTX
Introduction to Design of Machine Elements
PradeepKumarS27
 
PPTX
Presentation 2.pptx AI-powered home security systems Secure-by-design IoT fr...
SoundaryaBC2
 
PDF
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
PPTX
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
Halide Perovskites’ Multifunctional Properties: Coordination Engineering, Coo...
TaameBerhe2
 
Product Development & DevelopmentLecture02.pptx
zeeshanwazir2
 
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
MATLAB : Introduction , Features , Display Windows, Syntax, Operators, Graph...
Amity University, Patna
 
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
JappanMavani
 
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
MRRS Strength and Durability of Concrete
CivilMythili
 
What is Shot Peening | Shot Peening is a Surface Treatment Process
Vibra Finish
 
Introduction to Design of Machine Elements
PradeepKumarS27
 
Presentation 2.pptx AI-powered home security systems Secure-by-design IoT fr...
SoundaryaBC2
 
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
Ad

One dimensional operation of Array in C- language

  • 1. //Array operation in C languages. #include<stdio.h> #include<stdlib.h> #include<conio.h> void main() { int a[10]; int i,c; int n; clrscr(); printf("How many values u want to store: "); scanf("%d",&n); printf("Enter the elements"); for(i=0;i<n;i++) scanf("%d",&a[i]); while(1) { printf("Enter ur choice: n1.Insertionn2.Deletionn3.sortingn4.Searchn5.Displayn6.Exit "); scanf("%d",&c); switch(c) { case 1: { int p,item;
  • 2. clrscr(); printf("nEnter the element"); scanf("%d",&item); printf("nEnter the position where u want to insert: "); scanf("%d",&p); for(i=n;i>=p;i--) a[i]=a[i-1]; a[p-1]=item; n++; printf("Element inserted successfully"); break; } case 2:{ int p; clrscr(); printf("nthe elements are"); for(i=0;i<n;i++) printf("%dt",a[i]); printf("nEnter the position where u want to delete: "); scanf("%d",&p); for(i=p;i<n;i++) a[i-1]=a[i]; n--;
  • 3. printf("Element deleted successfully"); break; } case 3: { int i,j,t; for(i=0;i<n-1;i++) for(j=0;j<n-i;j++) { if(a[j]>a[j+1]) { t=a[j+1]; a[j+1]=a[j] ; a[j]=t; } } printf("Element are sorted Successfully."); break; } case 4:{ int item,k=0; clrscr(); printf("Enter the element u want to search: "); scanf("%d",&item); for(i=0;i<n;i++)
  • 4. { if(a[i]==item) { k=i+1; printf("Element is found at %d location",k); } else { i++; } } if(k==0) { printf("Element is not found"); } break; } case 5:{ printf("The value of n=%d",n); printf("nthe elements are"); for(i=0;i<n;i++) printf("%dt",a[i]); break; }