SlideShare uma empresa Scribd logo
1 de 39
Baixar para ler offline
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

Mais conteúdo relacionado

Mais procurados

C programming array & shorting
C  programming array & shortingC  programming array & shorting
C programming array & shortingargusacademy
 
C Prog - Strings
C Prog - StringsC Prog - Strings
C Prog - Stringsvinay arora
 
Data Structures Using C Practical File
Data Structures Using C Practical File Data Structures Using C Practical File
Data Structures Using C Practical File Rahul Chugh
 
Practical File of C Language
Practical File of C LanguagePractical File of C Language
Practical File of C LanguageRAJWANT KAUR
 
C Prog. - Structures
C Prog. - StructuresC Prog. - Structures
C Prog. - Structuresvinay arora
 
Solutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structuresSolutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structuresLakshmi Sarvani Videla
 
Mcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singhMcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singhDIVYA SINGH
 
Data Structure using C
Data Structure using CData Structure using C
Data Structure using CBilal Mirza
 
Data Structures Practical File
Data Structures Practical File Data Structures Practical File
Data Structures Practical File Harjinder Singh
 
Data structure new lab manual
Data structure  new lab manualData structure  new lab manual
Data structure new lab manualSANTOSH RATH
 
Srinivas Reddy Amedapu C and Data Structures JNTUH Hyderabad
Srinivas Reddy Amedapu C and Data Structures JNTUH HyderabadSrinivas Reddy Amedapu C and Data Structures JNTUH Hyderabad
Srinivas Reddy Amedapu C and Data Structures JNTUH HyderabadSrinivas Reddy Amedapu
 
Os lab file c programs
Os lab file c programsOs lab file c programs
Os lab file c programsKandarp Tiwari
 
Data Structure Project File
Data Structure Project FileData Structure Project File
Data Structure Project FileDeyvessh kumar
 

Mais procurados (20)

C programming array & shorting
C  programming array & shortingC  programming array & shorting
C programming array & shorting
 
C Prog - Strings
C Prog - StringsC Prog - Strings
C Prog - Strings
 
C Programming Exam problems & Solution by sazzad hossain
C Programming Exam problems & Solution by sazzad hossainC Programming Exam problems & Solution by sazzad hossain
C Programming Exam problems & Solution by sazzad hossain
 
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 program
C programC program
C program
 
Practical File of C Language
Practical File of C LanguagePractical File of C Language
Practical File of C Language
 
C programs
C programsC programs
C programs
 
C Prog. - Structures
C Prog. - StructuresC Prog. - Structures
C Prog. - Structures
 
DataStructures notes
DataStructures notesDataStructures notes
DataStructures notes
 
Solutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structuresSolutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structures
 
Mcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singhMcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singh
 
C programs
C programsC programs
C programs
 
Data Structure using C
Data Structure using CData Structure using C
Data Structure using C
 
Data Structures Practical File
Data Structures Practical File Data Structures Practical File
Data Structures Practical File
 
Data structure new lab manual
Data structure  new lab manualData structure  new lab manual
Data structure new lab manual
 
Daa practicals
Daa practicalsDaa practicals
Daa practicals
 
Srinivas Reddy Amedapu C and Data Structures JNTUH Hyderabad
Srinivas Reddy Amedapu C and Data Structures JNTUH HyderabadSrinivas Reddy Amedapu C and Data Structures JNTUH Hyderabad
Srinivas Reddy Amedapu C and Data Structures JNTUH Hyderabad
 
programs
programsprograms
programs
 
Os lab file c programs
Os lab file c programsOs lab file c programs
Os lab file c programs
 
Data Structure Project File
Data Structure Project FileData Structure Project File
Data Structure Project File
 

Destaque

Візуальні еффекти на Unity3d
Візуальні еффекти на Unity3dВізуальні еффекти на Unity3d
Візуальні еффекти на Unity3dStfalcon Meetups
 
CS 354 Pixel Updating
CS 354 Pixel UpdatingCS 354 Pixel Updating
CS 354 Pixel UpdatingMark Kilgard
 
C Prog - Pointers
C Prog - PointersC Prog - Pointers
C Prog - Pointersvinay arora
 
Intellectual properties
Intellectual propertiesIntellectual properties
Intellectual propertiesSHIVANI SONI
 
Open GL T0074 56 sm1
Open GL T0074 56 sm1Open GL T0074 56 sm1
Open GL T0074 56 sm1Roziq Bahtiar
 
CS 354 Vector Graphics & Path Rendering
CS 354 Vector Graphics & Path RenderingCS 354 Vector Graphics & Path Rendering
CS 354 Vector Graphics & Path RenderingMark Kilgard
 
CS 354 Graphics Math
CS 354 Graphics MathCS 354 Graphics Math
CS 354 Graphics MathMark Kilgard
 
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. - 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. - Decision & Loop Controls
C Prog. - Decision & Loop ControlsC Prog. - Decision & Loop Controls
C Prog. - Decision & Loop Controlsvinay arora
 
C Prog - Functions
C Prog - FunctionsC Prog - Functions
C Prog - Functionsvinay arora
 
Lab exercise questions (AD & CD)
Lab exercise questions (AD & CD)Lab exercise questions (AD & CD)
Lab exercise questions (AD & CD)vinay arora
 
Graphics1 introduction
Graphics1 introductionGraphics1 introduction
Graphics1 introductionlokesh503
 
Handoff and its type
Handoff and its typeHandoff and its type
Handoff and its typeSHIVANI SONI
 
CG - Introduction to Computer Graphics
CG - Introduction to Computer GraphicsCG - Introduction to Computer Graphics
CG - Introduction to Computer Graphicsvinay arora
 
Chapter1 c programming data types, variables and constants
Chapter1 c programming   data types, variables and constantsChapter1 c programming   data types, variables and constants
Chapter1 c programming data types, variables and constantsvinay arora
 

Destaque (20)

Візуальні еффекти на Unity3d
Візуальні еффекти на Unity3dВізуальні еффекти на Unity3d
Візуальні еффекти на Unity3d
 
CS 354 Pixel Updating
CS 354 Pixel UpdatingCS 354 Pixel Updating
CS 354 Pixel Updating
 
Introduction graphics
Introduction graphicsIntroduction graphics
Introduction graphics
 
C Prog - Pointers
C Prog - PointersC Prog - Pointers
C Prog - Pointers
 
Intellectual properties
Intellectual propertiesIntellectual properties
Intellectual properties
 
Open GL T0074 56 sm1
Open GL T0074 56 sm1Open GL T0074 56 sm1
Open GL T0074 56 sm1
 
CS 354 Vector Graphics & Path Rendering
CS 354 Vector Graphics & Path RenderingCS 354 Vector Graphics & Path Rendering
CS 354 Vector Graphics & Path Rendering
 
CS 354 Graphics Math
CS 354 Graphics MathCS 354 Graphics Math
CS 354 Graphics Math
 
C Prog. - ASCII Values, Break, Continue
C Prog. -  ASCII Values, Break, ContinueC Prog. -  ASCII Values, Break, Continue
C Prog. - ASCII Values, Break, Continue
 
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. - Decision & Loop Controls
C Prog. - Decision & Loop ControlsC Prog. - Decision & Loop Controls
C Prog. - Decision & Loop Controls
 
C Prog - Functions
C Prog - FunctionsC Prog - Functions
C Prog - Functions
 
Lab exercise questions (AD & CD)
Lab exercise questions (AD & CD)Lab exercise questions (AD & CD)
Lab exercise questions (AD & CD)
 
Interaction devices in human Computer Interface(Human Computer interface tut...
 Interaction devices in human Computer Interface(Human Computer interface tut... Interaction devices in human Computer Interface(Human Computer interface tut...
Interaction devices in human Computer Interface(Human Computer interface tut...
 
Graphics1 introduction
Graphics1 introductionGraphics1 introduction
Graphics1 introduction
 
Cse
CseCse
Cse
 
Handoff and its type
Handoff and its typeHandoff and its type
Handoff and its type
 
Rasterization
RasterizationRasterization
Rasterization
 
CG - Introduction to Computer Graphics
CG - Introduction to Computer GraphicsCG - Introduction to Computer Graphics
CG - Introduction to Computer Graphics
 
Chapter1 c programming data types, variables and constants
Chapter1 c programming   data types, variables and constantsChapter1 c programming   data types, variables and constants
Chapter1 c programming data types, variables and constants
 

Semelhante a C Prog - Array

Semelhante a 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
 
DSC program.pdf
DSC program.pdfDSC program.pdf
DSC program.pdf
 
ADA FILE
ADA FILEADA FILE
ADA FILE
 
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
 

Mais de vinay arora

Search engine and web crawler
Search engine and web crawlerSearch engine and web crawler
Search engine and web crawlervinay 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
 
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
 
A&D - Input Design
A&D - Input DesignA&D - Input Design
A&D - Input Designvinay arora
 

Mais de vinay arora (20)

Search engine and web crawler
Search engine and web crawlerSearch engine and web crawler
Search engine and web crawler
 
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
 
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
 
A&D - Input Design
A&D - Input DesignA&D - Input Design
A&D - Input Design
 

Último

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 

Último (20)

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 

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