SlideShare une entreprise Scribd logo
1  sur  39
Télécharger pour lire hors ligne
C Programming - Array

Organized By: Vinay Arora
               Assistant Professor, CSED
               Thapar University, Patiala
Program - 1
 #include<stdio.h>                       printf("Entered Numbers aren");
 #include<conio.h>                       for(count=0;count<=4;count++)
                                          {
 void main()                                     printf("%dn",num[count]);
                                          }
  {                                     getch();
   int num[5];                         }
   int count;
   clrscr();

    printf("Enter five numbersn");
     for(count=0;count<=4;count++)
      {
            scanf("%d",&num[count]);
      }


                                   Vinay Arora
                                      CSED
Program – 1 (output)




                Vinay Arora
                   CSED
Program - 2
 #include<stdio.h>                        for(count=0;count<=4;count++)
 #include<conio.h>                             {
                                                    sum=sum+marks[count];
 void main()                                   }
  {
   int marks[5];                              printf("Total Markst%d",sum);
   int count,sum=0;                          getch();
   clrscr();                                }

   printf("Enter Marks of Five Studentsn");
    for(count=0;count<=4;count++)
     {
           scanf("%d",&marks[count]);
     }



                                   Vinay Arora
                                      CSED
Program – 2 (output)




                Vinay Arora
                   CSED
Program - 3
          #include<stdio.h>
          #include<conio.h>
           void main()
            {
             int num[26], temp ;
             clrscr();

              num[0] = 100 ;
              num[25] = 200 ;

              temp = num[25] ;
              num[25] = num[0] ;
              num[0] = temp ;

               printf ( "n%d %d", num[0], num[25] ) ;
               getch();
              }
                         Vinay Arora
                            CSED
Program – 3 (output)




                Vinay Arora
                   CSED
Program - 4
#include<stdio.h>                                  for (count=0;count<=4;count++)
#include<conio.h>                                   {
                                                     if(element==num[count])
 void main()                                          {
  {                                                        flag=1;
   int num[5],element,count,flag;                          break;
   clrscr();                                          }
                                                     else
  printf("Enter the Array Elementsn");                    flag=0;
  for (count=0;count<=4;count++)                    }
   {
    scanf("%d",&num[count]);                      if(flag==1)
   }                                                printf("Element Found");
                                                  else
  printf("Enter the Element to be Searchedt");     printf("Element Not Found");
  scanf("%d",&element);                          getch();
                                                }
                                     Vinay Arora
                                        CSED
Program - 4
#include<stdio.h>                                  for (count=0;count<=4;count++)
#include<conio.h>                                   {
                                                     if(element==num[count])
 void main()                                          {
  {                                                        flag=1;
   int num[5],element,count,flag;                          break;
   clrscr();                                          }
                                                     else
  printf("Enter the Array Elementsn");                    flag=0;
  for (count=0;count<=4;count++)                    }
   {
    scanf("%d",&num[count]);                      if(flag==1)
   }                                                printf("Element Found");
                                                  else
  printf("Enter the Element to be Searchedt");     printf("Element Not Found");
  scanf("%d",&element);                          getch();
                                                }
                                     Vinay Arora
                                        CSED
Program – 4 (output)




                Vinay Arora
                   CSED
Program - 5
         #include<stdio.h>
         #include<conio.h>

         void main()
          {
           int num[5],count;
           clrscr();

           printf("Enter the Array Elementsn");
            for (count=0;count<=4;count++)
             {
              num[count]=count;
              printf("%dn",num[count]);
             }
           getch();
          }

                          Vinay Arora
                             CSED
Program – 5 (output)




                Vinay Arora
                   CSED
Program - 6
         #include<stdio.h>
         #include<conio.h>

         void main()
          {
           int num[5],count;
           clrscr();

           printf("Enter the Array Elementsn");
            for (count=0;count<=10;count++)
             {
              printf("%dn",num[count]);
             }
           getch();
          }


                        Vinay Arora
                           CSED
Program – 6 (output)




                Vinay Arora
                   CSED
Program - 7
         #include<stdio.h>
         #include<conio.h>

         void main()
          {
           int num[5]={22,4,77,8,9}
           int count;
           clrscr();

           printf("Array Elements aren");
            for (count=0;count<=4;count++)
             {
              printf("%dn",num[count]);
             }
           getch();
          }

                         Vinay Arora
                            CSED
Program – 7 (output)




                Vinay Arora
                   CSED
Program - 8
         #include<stdio.h>
         #include<conio.h>

         void main()
          {
           int num[5]={22,4,77,8,9};
           int count;
           clrscr();

           printf("Array Elements aren");
            for (count=0;count<=15;count++)
             {
              printf("%dn",num[count]);
             }
           getch();
          }

                         Vinay Arora
                            CSED
Program – 8 (output)




                Vinay Arora
                   CSED
2 – D Array




              Vinay Arora
                 CSED
2 – D Array Declaration




                Vinay Arora
                   CSED
Memory Representation




               Vinay Arora
                  CSED
Program - 9
       #include<stdio.h>
       #include<conio.h>

        void main()
         {
          int num[3][2]={10,1,20,2,30,3};
          int count;
          clrscr();

         printf("Array Elements aren");
          for (count=0;count<=2;count++)
           {
            printf("t%dt%dn",num[count][0],num[count][1]);
           }
         getch();
        }

                            Vinay Arora
                               CSED
Program – 9 (output)




                Vinay Arora
                   CSED
Program - 10
  #include<stdio.h>
  #include<conio.h>

  void main()
   {
    int marks[2][3];
    int count;
    clrscr();

   printf("Enter the marks for 1st studentn");
   for (count=0;count<=2;count++)
    {
     printf("Enter marks in subject code -> %dt",count+1);
     scanf("%d",&marks[0][count]);
    }

   printf("Enter the marks for 2nd studentn");
   for (count=0;count<=2;count++)
    {
     printf("Enter marks in subject code -> %dt",count+1);
                                                              getch();
     scanf("%d",&marks[1][count]);                             }
    }
                                           Vinay Arora
                                              CSED
Program – 10 (output)




                Vinay Arora
                   CSED
Pointer Notation




                   Vinay Arora
                      CSED
Pointer Notation (Conti…)




                Vinay Arora
                   CSED
Pointer Notation (Conti…)




                Vinay Arora
                   CSED
Program - 11
        #include<stdio.h>
        #include<conio.h>

        void main()
         {
          int a=3;
          clrscr();

         printf("Value of variable a=%d",a);
         printf("nAddress of variable a=%u",&a);

          getch();
         }




                            Vinay Arora
                               CSED
Program – 11 (output)




                Vinay Arora
                   CSED
Program - 12
       #include<stdio.h>
       #include<conio.h>

       void main()
        {
         int a[]={10,20};
         int i;
         clrscr();

         for(i=0;i<=1;i++)
          {
           printf("Value of variable a[%d]=%d",i,a[i]);
           printf("nAddress of variable a[%d]=%u",i,&a[i]);
           printf("nn");
          }
         getch();
        }
                            Vinay Arora
                               CSED
Program – 12 (output)




                Vinay Arora
                   CSED
Program - 13
       #include<stdio.h>
       #include<conio.h>

       void main()
        {
         int a[2][2]={10,20,30,40};
         int i,j;
         clrscr();

         for(i=0;i<=1;i++)
          {
           for(j=0;j<=1;j++)
            {
             printf("Value of variable a[%d][%d]=%d",i,j,a[i][j]);
             printf("nAddress of variable a[%d][%d]=%u",i,j,&a[i][j]);
             printf("nn");
            }
          }
         getch();
        }
                                Vinay Arora
                                   CSED
Program – 13 (output)




                Vinay Arora
                   CSED
Program - 14
         #include<stdio.h>
         #include<conio.h>

          void main()
           {
            int a=50;
            clrscr();

           printf("nValue of a=%d",a);
           printf("nAddress of a=%u",&a);

           printf("nn(Using pointer *)");
           printf("nValue of a=%d",*(&a));

           getch();
          }

                        Vinay Arora
                           CSED
Program – 14 (output)




                Vinay Arora
                   CSED
Program - 15
        #include<stdio.h>
        #include<conio.h>

        void main()
         {
          int i=10;
          int *j;
          clrscr();

         printf("nValue of i=%d",i);
         printf("nAddress of i=%u",&i);

         j=&i;
         printf("nValue of j=%d",*j);

          getch();
         }
                          Vinay Arora
                             CSED
Program – 15 (output)




                Vinay Arora
                   CSED
Thnx…



  Vinay Arora
     CSED

Contenu connexe

Tendances

Tendances (20)

Programming Fundamentals Arrays and Strings
Programming Fundamentals   Arrays and Strings Programming Fundamentals   Arrays and Strings
Programming Fundamentals Arrays and Strings
 
Data Structure Project File
Data Structure Project FileData Structure Project File
Data Structure Project File
 
Pnno
PnnoPnno
Pnno
 
Data structure new lab manual
Data structure  new lab manualData structure  new lab manual
Data structure new lab manual
 
design and analysis of algorithm Lab files
design and analysis of algorithm Lab filesdesign and analysis of algorithm Lab files
design and analysis of algorithm Lab files
 
ADA FILE
ADA FILEADA FILE
ADA FILE
 
Data struture lab
Data struture labData struture lab
Data struture lab
 
Cquestions
Cquestions Cquestions
Cquestions
 
Data Structure using C
Data Structure using CData Structure using C
Data Structure using C
 
Data Structures Using C Practical File
Data Structures Using C Practical File Data Structures Using C Practical File
Data Structures Using C Practical File
 
C programming
C programmingC programming
C programming
 
Ada file
Ada fileAda file
Ada file
 
DataStructures notes
DataStructures notesDataStructures notes
DataStructures notes
 
Array
ArrayArray
Array
 
Data structures lab manual
Data structures lab manualData structures lab manual
Data structures lab manual
 
4. chapter iii
4. chapter iii4. chapter iii
4. chapter iii
 
C lab excellent
C lab excellentC lab excellent
C lab excellent
 
Lab manual data structure (cs305 rgpv) (usefulsearch.org) (useful search)
Lab manual data structure (cs305 rgpv) (usefulsearch.org)  (useful search)Lab manual data structure (cs305 rgpv) (usefulsearch.org)  (useful search)
Lab manual data structure (cs305 rgpv) (usefulsearch.org) (useful search)
 
VTU Data Structures Lab Manual
VTU Data Structures Lab ManualVTU Data Structures Lab Manual
VTU Data Structures Lab Manual
 
3. chapter ii
3. chapter ii3. chapter ii
3. chapter ii
 

En vedette

C Tutorial
C TutorialC Tutorial
C Tutorialbiochelo
 
C Prog - Functions
C Prog - FunctionsC Prog - Functions
C Prog - Functionsvinay arora
 
C Prog. - Data Types, Variables and Constants
C Prog. - Data Types, Variables and ConstantsC Prog. - Data Types, Variables and Constants
C Prog. - Data Types, Variables and Constantsvinay arora
 
C Prog. - ASCII Values, Break, Continue
C Prog. -  ASCII Values, Break, ContinueC Prog. -  ASCII Values, Break, Continue
C Prog. - ASCII Values, Break, Continuevinay arora
 
C Prog - Pointers
C Prog - PointersC Prog - Pointers
C Prog - Pointersvinay arora
 
C Prog. - Decision & Loop Controls
C Prog. - Decision & Loop ControlsC Prog. - Decision & Loop Controls
C Prog. - Decision & Loop Controlsvinay arora
 
CG - Introduction to Computer Graphics
CG - Introduction to Computer GraphicsCG - Introduction to Computer Graphics
CG - Introduction to Computer Graphicsvinay arora
 
Search engine and web crawler
Search engine and web crawlerSearch engine and web crawler
Search engine and web crawlervinay arora
 
C Prog. - Introduction to Hardware, Software, Algorithm & Flowchart
C Prog. - Introduction to Hardware, Software, Algorithm & FlowchartC Prog. - Introduction to Hardware, Software, Algorithm & Flowchart
C Prog. - Introduction to Hardware, Software, Algorithm & Flowchartvinay arora
 
Advanced SQL - Lecture 6 - Introduction to Databases (1007156ANR)
Advanced SQL - Lecture 6 - Introduction to Databases (1007156ANR)Advanced SQL - Lecture 6 - Introduction to Databases (1007156ANR)
Advanced SQL - Lecture 6 - Introduction to Databases (1007156ANR)Beat Signer
 
Course Review - Lecture 12 - Next Generation User Interfaces (4018166FNR)
Course Review - Lecture 12 - Next Generation User Interfaces (4018166FNR)Course Review - Lecture 12 - Next Generation User Interfaces (4018166FNR)
Course Review - Lecture 12 - Next Generation User Interfaces (4018166FNR)Beat Signer
 
Top 100 SQL Interview Questions and Answers
Top 100 SQL Interview Questions and AnswersTop 100 SQL Interview Questions and Answers
Top 100 SQL Interview Questions and Answersiimjobs and hirist
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGAbhishek Dwivedi
 
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Beat Signer
 
Relational Database Design - Lecture 4 - Introduction to Databases (1007156ANR)
Relational Database Design - Lecture 4 - Introduction to Databases (1007156ANR)Relational Database Design - Lecture 4 - Introduction to Databases (1007156ANR)
Relational Database Design - Lecture 4 - Introduction to Databases (1007156ANR)Beat Signer
 
Row Pattern Matching in SQL:2016
Row Pattern Matching in SQL:2016Row Pattern Matching in SQL:2016
Row Pattern Matching in SQL:2016Markus Winand
 

En vedette (20)

C Tutorial
C TutorialC Tutorial
C Tutorial
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
C programming tutorial
C programming tutorialC programming tutorial
C programming tutorial
 
C Prog - Functions
C Prog - FunctionsC Prog - Functions
C Prog - Functions
 
C Prog. - Data Types, Variables and Constants
C Prog. - Data Types, Variables and ConstantsC Prog. - Data Types, Variables and Constants
C Prog. - Data Types, Variables and Constants
 
C Prog. - ASCII Values, Break, Continue
C Prog. -  ASCII Values, Break, ContinueC Prog. -  ASCII Values, Break, Continue
C Prog. - ASCII Values, Break, Continue
 
C programming slide-6
C programming slide-6C programming slide-6
C programming slide-6
 
C Prog - Pointers
C Prog - PointersC Prog - Pointers
C Prog - Pointers
 
C Prog. - Decision & Loop Controls
C Prog. - Decision & Loop ControlsC Prog. - Decision & Loop Controls
C Prog. - Decision & Loop Controls
 
CG - Introduction to Computer Graphics
CG - Introduction to Computer GraphicsCG - Introduction to Computer Graphics
CG - Introduction to Computer Graphics
 
Search engine and web crawler
Search engine and web crawlerSearch engine and web crawler
Search engine and web crawler
 
C Prog. - Introduction to Hardware, Software, Algorithm & Flowchart
C Prog. - Introduction to Hardware, Software, Algorithm & FlowchartC Prog. - Introduction to Hardware, Software, Algorithm & Flowchart
C Prog. - Introduction to Hardware, Software, Algorithm & Flowchart
 
Advanced SQL - Lecture 6 - Introduction to Databases (1007156ANR)
Advanced SQL - Lecture 6 - Introduction to Databases (1007156ANR)Advanced SQL - Lecture 6 - Introduction to Databases (1007156ANR)
Advanced SQL - Lecture 6 - Introduction to Databases (1007156ANR)
 
Course Review - Lecture 12 - Next Generation User Interfaces (4018166FNR)
Course Review - Lecture 12 - Next Generation User Interfaces (4018166FNR)Course Review - Lecture 12 - Next Generation User Interfaces (4018166FNR)
Course Review - Lecture 12 - Next Generation User Interfaces (4018166FNR)
 
Top 100 SQL Interview Questions and Answers
Top 100 SQL Interview Questions and AnswersTop 100 SQL Interview Questions and Answers
Top 100 SQL Interview Questions and Answers
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
 
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
 
C language ppt
C language pptC language ppt
C language ppt
 
Relational Database Design - Lecture 4 - Introduction to Databases (1007156ANR)
Relational Database Design - Lecture 4 - Introduction to Databases (1007156ANR)Relational Database Design - Lecture 4 - Introduction to Databases (1007156ANR)
Relational Database Design - Lecture 4 - Introduction to Databases (1007156ANR)
 
Row Pattern Matching in SQL:2016
Row Pattern Matching in SQL:2016Row Pattern Matching in SQL:2016
Row Pattern Matching in SQL:2016
 

Similaire à C Prog - Array

Similaire à C Prog - Array (20)

Ds
DsDs
Ds
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
 
SaraPIC
SaraPICSaraPIC
SaraPIC
 
Cpds lab
Cpds labCpds lab
Cpds lab
 
DSC program.pdf
DSC program.pdfDSC program.pdf
DSC program.pdf
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
 
programs on arrays.pdf
programs on arrays.pdfprograms on arrays.pdf
programs on arrays.pdf
 
Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02
 
1D Array
1D Array1D Array
1D Array
 
All important c programby makhan kumbhkar
All important c programby makhan kumbhkarAll important c programby makhan kumbhkar
All important c programby makhan kumbhkar
 
Arrays
ArraysArrays
Arrays
 
C programs
C programsC programs
C programs
 
C programs Set 2
C programs Set 2C programs Set 2
C programs Set 2
 
Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020
 
Unix Programs
Unix ProgramsUnix Programs
Unix Programs
 
Practical write a c program to reverse a given number
Practical write a c program to reverse a given numberPractical write a c program to reverse a given number
Practical write a c program to reverse a given number
 
Practical write a c program to reverse a given number
Practical write a c program to reverse a given numberPractical write a c program to reverse a given number
Practical write a c program to reverse a given number
 
PCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdfPCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdf
 
PCA-2 Programming and Solving 2nd Sem.docx
PCA-2 Programming and Solving 2nd Sem.docxPCA-2 Programming and Solving 2nd Sem.docx
PCA-2 Programming and Solving 2nd Sem.docx
 
week-21x
week-21xweek-21x
week-21x
 

Plus de vinay arora

Use case diagram (airport)
Use case diagram (airport)Use case diagram (airport)
Use case diagram (airport)vinay arora
 
Use case diagram
Use case diagramUse case diagram
Use case diagramvinay arora
 
Lab exercise questions (AD & CD)
Lab exercise questions (AD & CD)Lab exercise questions (AD & CD)
Lab exercise questions (AD & CD)vinay arora
 
SEM - UML (1st case study)
SEM - UML (1st case study)SEM - UML (1st case study)
SEM - UML (1st case study)vinay arora
 
4 java - decision
4  java - decision4  java - decision
4 java - decisionvinay arora
 
3 java - variable type
3  java - variable type3  java - variable type
3 java - variable typevinay arora
 
2 java - operators
2  java - operators2  java - operators
2 java - operatorsvinay arora
 
1 java - data type
1  java - data type1  java - data type
1 java - data typevinay arora
 
Security & Protection
Security & ProtectionSecurity & Protection
Security & Protectionvinay arora
 
Process Synchronization
Process SynchronizationProcess Synchronization
Process Synchronizationvinay arora
 
CG - Output Primitives
CG - Output PrimitivesCG - Output Primitives
CG - Output Primitivesvinay arora
 
CG - Display Devices
CG - Display DevicesCG - Display Devices
CG - Display Devicesvinay arora
 
CG - Input Output Devices
CG - Input Output DevicesCG - Input Output Devices
CG - Input Output Devicesvinay arora
 
A&D - Object Oriented Design using UML
A&D - Object Oriented Design using UMLA&D - Object Oriented Design using UML
A&D - Object Oriented Design using UMLvinay arora
 

Plus de vinay arora (20)

Use case diagram (airport)
Use case diagram (airport)Use case diagram (airport)
Use case diagram (airport)
 
Use case diagram
Use case diagramUse case diagram
Use case diagram
 
Lab exercise questions (AD & CD)
Lab exercise questions (AD & CD)Lab exercise questions (AD & CD)
Lab exercise questions (AD & CD)
 
SEM - UML (1st case study)
SEM - UML (1st case study)SEM - UML (1st case study)
SEM - UML (1st case study)
 
6 java - loop
6  java - loop6  java - loop
6 java - loop
 
4 java - decision
4  java - decision4  java - decision
4 java - decision
 
3 java - variable type
3  java - variable type3  java - variable type
3 java - variable type
 
2 java - operators
2  java - operators2  java - operators
2 java - operators
 
1 java - data type
1  java - data type1  java - data type
1 java - data type
 
Uta005 lecture3
Uta005 lecture3Uta005 lecture3
Uta005 lecture3
 
Uta005 lecture1
Uta005 lecture1Uta005 lecture1
Uta005 lecture1
 
Uta005 lecture2
Uta005 lecture2Uta005 lecture2
Uta005 lecture2
 
Security & Protection
Security & ProtectionSecurity & Protection
Security & Protection
 
Process Synchronization
Process SynchronizationProcess Synchronization
Process Synchronization
 
CG - Output Primitives
CG - Output PrimitivesCG - Output Primitives
CG - Output Primitives
 
CG - Display Devices
CG - Display DevicesCG - Display Devices
CG - Display Devices
 
CG - Input Output Devices
CG - Input Output DevicesCG - Input Output Devices
CG - Input Output Devices
 
A&D - UML
A&D - UMLA&D - UML
A&D - UML
 
A&D - Object Oriented Design using UML
A&D - Object Oriented Design using UMLA&D - Object Oriented Design using UML
A&D - Object Oriented Design using UML
 
C Prog - Array
C Prog - ArrayC Prog - Array
C Prog - Array
 

Dernier

Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 

Dernier (20)

Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 

C Prog - Array

  • 1. C Programming - Array Organized By: Vinay Arora Assistant Professor, CSED Thapar University, Patiala
  • 2. Program - 1 #include<stdio.h> printf("Entered Numbers aren"); #include<conio.h> for(count=0;count<=4;count++) { void main() printf("%dn",num[count]); } { getch(); int num[5]; } int count; clrscr(); printf("Enter five numbersn"); for(count=0;count<=4;count++) { scanf("%d",&num[count]); } Vinay Arora CSED
  • 3. Program – 1 (output) Vinay Arora CSED
  • 4. Program - 2 #include<stdio.h> for(count=0;count<=4;count++) #include<conio.h> { sum=sum+marks[count]; void main() } { int marks[5]; printf("Total Markst%d",sum); int count,sum=0; getch(); clrscr(); } printf("Enter Marks of Five Studentsn"); for(count=0;count<=4;count++) { scanf("%d",&marks[count]); } Vinay Arora CSED
  • 5. Program – 2 (output) Vinay Arora CSED
  • 6. Program - 3 #include<stdio.h> #include<conio.h> void main() { int num[26], temp ; clrscr(); num[0] = 100 ; num[25] = 200 ; temp = num[25] ; num[25] = num[0] ; num[0] = temp ; printf ( "n%d %d", num[0], num[25] ) ; getch(); } Vinay Arora CSED
  • 7. Program – 3 (output) Vinay Arora CSED
  • 8. Program - 4 #include<stdio.h> for (count=0;count<=4;count++) #include<conio.h> { if(element==num[count]) void main() { { flag=1; int num[5],element,count,flag; break; clrscr(); } else printf("Enter the Array Elementsn"); flag=0; for (count=0;count<=4;count++) } { scanf("%d",&num[count]); if(flag==1) } printf("Element Found"); else printf("Enter the Element to be Searchedt"); printf("Element Not Found"); scanf("%d",&element); getch(); } Vinay Arora CSED
  • 9. Program - 4 #include<stdio.h> for (count=0;count<=4;count++) #include<conio.h> { if(element==num[count]) void main() { { flag=1; int num[5],element,count,flag; break; clrscr(); } else printf("Enter the Array Elementsn"); flag=0; for (count=0;count<=4;count++) } { scanf("%d",&num[count]); if(flag==1) } printf("Element Found"); else printf("Enter the Element to be Searchedt"); printf("Element Not Found"); scanf("%d",&element); getch(); } Vinay Arora CSED
  • 10. Program – 4 (output) Vinay Arora CSED
  • 11. Program - 5 #include<stdio.h> #include<conio.h> void main() { int num[5],count; clrscr(); printf("Enter the Array Elementsn"); for (count=0;count<=4;count++) { num[count]=count; printf("%dn",num[count]); } getch(); } Vinay Arora CSED
  • 12. Program – 5 (output) Vinay Arora CSED
  • 13. Program - 6 #include<stdio.h> #include<conio.h> void main() { int num[5],count; clrscr(); printf("Enter the Array Elementsn"); for (count=0;count<=10;count++) { printf("%dn",num[count]); } getch(); } Vinay Arora CSED
  • 14. Program – 6 (output) Vinay Arora CSED
  • 15. Program - 7 #include<stdio.h> #include<conio.h> void main() { int num[5]={22,4,77,8,9} int count; clrscr(); printf("Array Elements aren"); for (count=0;count<=4;count++) { printf("%dn",num[count]); } getch(); } Vinay Arora CSED
  • 16. Program – 7 (output) Vinay Arora CSED
  • 17. Program - 8 #include<stdio.h> #include<conio.h> void main() { int num[5]={22,4,77,8,9}; int count; clrscr(); printf("Array Elements aren"); for (count=0;count<=15;count++) { printf("%dn",num[count]); } getch(); } Vinay Arora CSED
  • 18. Program – 8 (output) Vinay Arora CSED
  • 19. 2 – D Array Vinay Arora CSED
  • 20. 2 – D Array Declaration Vinay Arora CSED
  • 21. Memory Representation Vinay Arora CSED
  • 22. Program - 9 #include<stdio.h> #include<conio.h> void main() { int num[3][2]={10,1,20,2,30,3}; int count; clrscr(); printf("Array Elements aren"); for (count=0;count<=2;count++) { printf("t%dt%dn",num[count][0],num[count][1]); } getch(); } Vinay Arora CSED
  • 23. Program – 9 (output) Vinay Arora CSED
  • 24. Program - 10 #include<stdio.h> #include<conio.h> void main() { int marks[2][3]; int count; clrscr(); printf("Enter the marks for 1st studentn"); for (count=0;count<=2;count++) { printf("Enter marks in subject code -> %dt",count+1); scanf("%d",&marks[0][count]); } printf("Enter the marks for 2nd studentn"); for (count=0;count<=2;count++) { printf("Enter marks in subject code -> %dt",count+1); getch(); scanf("%d",&marks[1][count]); } } Vinay Arora CSED
  • 25. Program – 10 (output) Vinay Arora CSED
  • 26. Pointer Notation Vinay Arora CSED
  • 27. Pointer Notation (Conti…) Vinay Arora CSED
  • 28. Pointer Notation (Conti…) Vinay Arora CSED
  • 29. Program - 11 #include<stdio.h> #include<conio.h> void main() { int a=3; clrscr(); printf("Value of variable a=%d",a); printf("nAddress of variable a=%u",&a); getch(); } Vinay Arora CSED
  • 30. Program – 11 (output) Vinay Arora CSED
  • 31. Program - 12 #include<stdio.h> #include<conio.h> void main() { int a[]={10,20}; int i; clrscr(); for(i=0;i<=1;i++) { printf("Value of variable a[%d]=%d",i,a[i]); printf("nAddress of variable a[%d]=%u",i,&a[i]); printf("nn"); } getch(); } Vinay Arora CSED
  • 32. Program – 12 (output) Vinay Arora CSED
  • 33. Program - 13 #include<stdio.h> #include<conio.h> void main() { int a[2][2]={10,20,30,40}; int i,j; clrscr(); for(i=0;i<=1;i++) { for(j=0;j<=1;j++) { printf("Value of variable a[%d][%d]=%d",i,j,a[i][j]); printf("nAddress of variable a[%d][%d]=%u",i,j,&a[i][j]); printf("nn"); } } getch(); } Vinay Arora CSED
  • 34. Program – 13 (output) Vinay Arora CSED
  • 35. Program - 14 #include<stdio.h> #include<conio.h> void main() { int a=50; clrscr(); printf("nValue of a=%d",a); printf("nAddress of a=%u",&a); printf("nn(Using pointer *)"); printf("nValue of a=%d",*(&a)); getch(); } Vinay Arora CSED
  • 36. Program – 14 (output) Vinay Arora CSED
  • 37. Program - 15 #include<stdio.h> #include<conio.h> void main() { int i=10; int *j; clrscr(); printf("nValue of i=%d",i); printf("nAddress of i=%u",&i); j=&i; printf("nValue of j=%d",*j); getch(); } Vinay Arora CSED
  • 38. Program – 15 (output) Vinay Arora CSED
  • 39. Thnx… Vinay Arora CSED