SlideShare a Scribd company logo
Lectures on Programming with Arrays
for
Open Educational Resource
On
Programming Concepts (EC208)
by
Dr. Piyush Charan
Assistant Professor
Department of Electronics and Communication Engg.
Integral University, Lucknow
Introduction to Arrays
11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 2
Simple program on Arrays to accept ‘n’
numbers and display the same
11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 3
11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 4
11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 5
11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 6
11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 7
Sorting of Array- Bubble Sort
11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 8
#include<stdio.h>
#include<conio.h>
void main()
{
int a[50], n, i, j, temp;
clrscr();
printf("Enter the size of array=");
scanf("%d", &n);
printf("Enter the elements in the array: ");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
//Sorting Logic
printf("The Sorted Array in Ascending order is ");
for(i=0;i<=(n-2);i++)
{
for(j=0;j<=(n-2)-i;j++)
{
if (a[j]>a[j+1])
11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 9
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
//Printing Sorted Array Logic
for(i=0;i<n;i++)
{
printf("%d ",a[i]);
}
getch();
}
11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 10
Sum of Two Arrays
11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 11

More Related Content

PDF
Unit 3 Geothermal Energy
PDF
Unit 3 Lecture Notes on Programming
PDF
Unit 4 Lossy Coding Preliminaries
PDF
Unit 3: Programming with C/C++ contd.
PDF
Unit 2 data representation
PDF
Unit 3 lectures on programming
PDF
Unit 4_Part 1_Number System
PPTX
Fault Tree Analysis
Unit 3 Geothermal Energy
Unit 3 Lecture Notes on Programming
Unit 4 Lossy Coding Preliminaries
Unit 3: Programming with C/C++ contd.
Unit 2 data representation
Unit 3 lectures on programming
Unit 4_Part 1_Number System
Fault Tree Analysis

Similar to Unit 4 Arrays (20)

PPTX
INDIAN INSTITUTE OF TECHNOLOGY KANPUR ESC 111M Lec12.pptx
PPTX
Array 1D.................................pptx
PPTX
Array programs
PPTX
Arrays
PDF
PPTX
Ch-11-Arrays.ppt-1.pptx eurhrbdhdbdhrhdhdh
PPTX
COM1407: Arrays
PPTX
Arrays-from-Basics-to-Advanced final.pptx
PPTX
CSE 1102 - Lecture 6 - Arrays in C .pptx
PPT
Basics of Data structure using C describing basics concepts
PDF
arraysfor engineering students sdf ppt on arrays
PPT
358 33 powerpoint-slides_5-arrays_chapter-5
PDF
35001622067_SOUMYADIP MAITY .pdf C programming
PPTX
C_Arrays.pptx
PPT
Lecture 15 Arrays with C++ programming.ppt
PPTX
Module_3_Arrays - Updated.pptx............
PPTX
lecture 2.2.2 2D array.pptx IUGLFHLHFJFY
DOC
Basic c programs updated on 31.8.2020
PPTX
Arrays.pptx
INDIAN INSTITUTE OF TECHNOLOGY KANPUR ESC 111M Lec12.pptx
Array 1D.................................pptx
Array programs
Arrays
Ch-11-Arrays.ppt-1.pptx eurhrbdhdbdhrhdhdh
COM1407: Arrays
Arrays-from-Basics-to-Advanced final.pptx
CSE 1102 - Lecture 6 - Arrays in C .pptx
Basics of Data structure using C describing basics concepts
arraysfor engineering students sdf ppt on arrays
358 33 powerpoint-slides_5-arrays_chapter-5
35001622067_SOUMYADIP MAITY .pdf C programming
C_Arrays.pptx
Lecture 15 Arrays with C++ programming.ppt
Module_3_Arrays - Updated.pptx............
lecture 2.2.2 2D array.pptx IUGLFHLHFJFY
Basic c programs updated on 31.8.2020
Arrays.pptx
Ad

More from Dr Piyush Charan (20)

PDF
Unit 1- Intro to Wireless Standards.pdf
PPTX
Unit 1 Solar Collectors
PDF
Unit 5 Quantization
PDF
Unit 2: Programming Language Tools
PDF
Unit 3 introduction to programming
PDF
Forensics and wireless body area networks
PDF
Final PhD Defense Presentation
PDF
Unit 3 Arithmetic Coding
PDF
Unit 2 Lecture notes on Huffman coding
PDF
Unit 1 Introduction to Data Compression
PDF
Unit 3 Dictionary based Compression Techniques
PDF
Unit 1 Introduction to Non-Conventional Energy Resources
PDF
Unit 5-Operational Amplifiers and Electronic Measurement Devices
PDF
Unit 1 Introduction to Data Compression
PDF
Unit 4 Switching Theory and Logic Gates
PDF
Unit 1 Numerical Problems on PN Junction Diode
PDF
Unit 5 Global Issues- Early life of Prophet Muhammad
PDF
Unit 4 Engineering Ethics
PDF
Unit 3 Professional Responsibility
PDF
Unit 5 oscillators and voltage regulators
Unit 1- Intro to Wireless Standards.pdf
Unit 1 Solar Collectors
Unit 5 Quantization
Unit 2: Programming Language Tools
Unit 3 introduction to programming
Forensics and wireless body area networks
Final PhD Defense Presentation
Unit 3 Arithmetic Coding
Unit 2 Lecture notes on Huffman coding
Unit 1 Introduction to Data Compression
Unit 3 Dictionary based Compression Techniques
Unit 1 Introduction to Non-Conventional Energy Resources
Unit 5-Operational Amplifiers and Electronic Measurement Devices
Unit 1 Introduction to Data Compression
Unit 4 Switching Theory and Logic Gates
Unit 1 Numerical Problems on PN Junction Diode
Unit 5 Global Issues- Early life of Prophet Muhammad
Unit 4 Engineering Ethics
Unit 3 Professional Responsibility
Unit 5 oscillators and voltage regulators
Ad

Recently uploaded (20)

PPT
Mechanical Engineering MATERIALS Selection
PPTX
Sustainable Sites - Green Building Construction
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
web development for engineering and engineering
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
Welding lecture in detail for understanding
PPTX
OOP with Java - Java Introduction (Basics)
PPT
Project quality management in manufacturing
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
Well-logging-methods_new................
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
UNIT 4 Total Quality Management .pptx
Mechanical Engineering MATERIALS Selection
Sustainable Sites - Green Building Construction
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
web development for engineering and engineering
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Welding lecture in detail for understanding
OOP with Java - Java Introduction (Basics)
Project quality management in manufacturing
Operating System & Kernel Study Guide-1 - converted.pdf
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Foundation to blockchain - A guide to Blockchain Tech
Well-logging-methods_new................
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
UNIT 4 Total Quality Management .pptx

Unit 4 Arrays

  • 1. Lectures on Programming with Arrays for Open Educational Resource On Programming Concepts (EC208) by Dr. Piyush Charan Assistant Professor Department of Electronics and Communication Engg. Integral University, Lucknow
  • 2. Introduction to Arrays 11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 2
  • 3. Simple program on Arrays to accept ‘n’ numbers and display the same 11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 3
  • 4. 11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 4
  • 5. 11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 5
  • 6. 11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 6
  • 7. 11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 7
  • 8. Sorting of Array- Bubble Sort 11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 8 #include<stdio.h> #include<conio.h> void main() { int a[50], n, i, j, temp; clrscr(); printf("Enter the size of array="); scanf("%d", &n); printf("Enter the elements in the array: "); for(i=0;i<n;i++) { scanf("%d",&a[i]); } //Sorting Logic printf("The Sorted Array in Ascending order is "); for(i=0;i<=(n-2);i++) { for(j=0;j<=(n-2)-i;j++) { if (a[j]>a[j+1])
  • 9. 11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 9 { temp=a[j]; a[j]=a[j+1]; a[j+1]=temp; } } } //Printing Sorted Array Logic for(i=0;i<n;i++) { printf("%d ",a[i]); } getch(); }
  • 10. 11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 10 Sum of Two Arrays
  • 11. 11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 11