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

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
 

Tendances (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
 

En vedette

Візуальні еффекти на 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
 

En vedette (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
 

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
 
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
 

Plus 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
 

Plus 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
 

Dernier

Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIShubhangi Sonawane
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
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
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
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
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 

Dernier (20)

Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
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
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
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Ữ Â...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
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
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
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
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 

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