SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Andere mochten auch

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

Andere mochten auch (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
 

Ähnlich wie C Prog - Array

Ähnlich wie 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
 

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

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

Kürzlich hochgeladen

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
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
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
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
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
“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
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
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
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
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
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 

Kürzlich hochgeladen (20)

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
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...
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
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
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
“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...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
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
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
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
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 

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