SlideShare a Scribd company logo
1 of 18
Сабақ тақырыбы:
Екі өлшемді жиымдарды
        өңдеу
Сабақ жоспары
   Екі өлшемді массив элементтерін сипаттау
   Екі өлшемді массив элементтерін енгізу және
    баспалау тәсілдері
   Массивтерді өңдеудің базалық алгоритмдері
−   Массив элементтерінің қосындысы, көбейтіндісін
    табу;
−   Қандай да бір шартты қанағаттандыратын элементтер
    санын анықтау;
−   Квадрат матрицаның бас және қосалқы диагональ
    элементтерінің қосындысын табу.
−   Бас диагональдан төмен не жоғары жатқан
    элементтер қосындысын, көбейтіндісін табу т.б.
Екі өлшемді массив элементтерін сипаттау
<тип> <жиым атауы>
[жол саны] [баған саны]
мысалы,
int a[3][4] – бүтін сандар жиымы
a00 a01 a02 a03
a10 a11 a12 a13
a20 a21 a22 a23
float c[2][3] – нақты сандар жиымы
Екі өлшемді массив
элементтерін енгізу және
   баспалау тәсілдері
Екі өлшемді массив элементтерін баспалаудың
                              1-тәсілі
#include<stdio.h>
#include<conio.h>
#define n 3
#define m 4
main()
{clrscr();int a[n][m],i,j;
a[0][0]=4;a[0][1]=8;a[0][2]=-6;a[0][3]=9;
a[1][0]=5;a[1][1]=3;a[1][2]=-2;a[1][3]=7;
a[2][0]=1;a[2][1]=5;a[2][2]=-4;a[2][3]=-9;
for (i=0;i<n;i++)
{for (j=0;j<m;j++)
        printf("%d t",a[i][j]);
printf("n");
}
}
Екі өлшемді массив элементтерін баспалаудың
                      2-тәсілі
#include<stdio.h>
#include<conio.h>
#define n 3
#define m 4
main()
{clrscr();int a[n][m]={4,8,-6,9,-5,12,6,-2,3,-7,5,6}, i, j;
for (i=0; i<n; i++)
{for (j=0; j<m; j++)
       printf ("%d t", a[i] [j]) ;
Printf ("n");
}
}
3- тәсіл: Жиымды кездейсоқ сандармен
                    толтыру
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#define n 3
#define m 4
main()
{clrscr();randomize();int a[n][m],i,j;
for (i=0;i<n;i++)
{for (j=0;j<m;j++)}
  {a[i][j]=random(10);
  printf("%d t",a[i][j]);}
printf("n");
}
}
Массивтерді өңдеудің базалық
       алгоритмдері
Екі өлшемді массив элементтерінің қосындысын, көбейтіндісін табу .
#include<stdio.h>
#include<conio.h>
#define n 3
#define m 4
main()
{clrscr();int a[n][m]={4,8,-6,9,-5,12,6,-2,3,-7,5,6},i,j,s=0,p=1;
for (i=0;i<n;i++)
{for (j=0;j<m;j++)
        printf("%d t",a[i][j]);
printf("n");
}
for (i=0;i<n;i++)
for (j=0;j<m;j++)
        {s+=a[i][j];
        p*=a[i][j];}
        printf("s=%d p=%d n",s,p);
}
Екі өлшемді массивтің оң элементтерінің саны мен теріс
                  элементтерінің қосындысын табу.
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#define n 3
#define m 4
main()
{clrscr();randomize();int a[n][m],i,j,k=0,s=0;
for (i=0;i<n;i++)
{for (j=0;j<m;j++)
                   {a[i][j]=random(10);
                   printf("%d t",a[i][j]);}
printf("n");
}
for (i=0;i<n;i++)
for (j=0;j<m;j++)
                   if (a[i][j]>0) k++;else s+=a[i][j];}
printf("s=%d k=%d n",s,k);
}
Екі өлшемді массивтің баған элементтерінің қосындысын табу.
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#define n 3
#define m 4
main()
{clrscr();randomize();int a[n][m],i,j,s;
for (i=0;i<n;i++)
{for (j=0;j<m;j++)
          {a[i][j]=random(10);
          printf("%d t",a[i][j]);}
printf("n");
}
for (j=0;j<m;j++)
{s=0;
for (i=0;i<n;i++)
          s+=a[i][j];
printf("%d n",s);
}
}
Квадрат матрицаның бас диагональ элементтерінің
қосындысы мен көбейтіндісін табу.
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#define n 3
main()
{clrscr();randomize();int a[n][n],i,j,s=0,p=1;
for (i=0;i<n;i++)
{for (j=0;j<n;j++)
         {a[i][j]=random(10);
         printf("%d t",a[i][j]);}
printf("n");
}
for (i=0;i<n;i++)
for (j=0;j<n;j++)
  if (i==j) {s+=a[i][j];p*=a[i][j];}
printf("s=%d p=%d n",s,p);
Квадрат матрицаның бас диагональдан жоғары жатқан элементтерінің
қосындысын табу.
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#define n 3

main()
{clrscr();randomize();int a[n][n],i,j,s=0;
for (i=0;i<n;i++)
{for (j=0;j<n;j++)
          {a[i][j]=random(10);
          printf("%d t",a[i][j]);}
printf("n");
}
for (i=0;i<n;i++)
for (j=0;j<n;j++)
  if (i<j) s+=a[i][j];
printf("s=%d n",s);
}
Квадрат матрицаның қосалқы диагональ элементтерінің
қосындысын табу.
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#define n 3
main()
{clrscr();randomize();int a[n][n],i,j,s=0;
for (i=0;i<n;i++)
{for (j=0;j<n;j++)
        {a[i][j]=random(10);
        printf("%d t",a[i][j]);}
printf("n");
}
for (i=0;i<n;i++)
  s+=a[i][n-1-i];
printf("s=%d n",s);
Квадрат матрицаның бас диагоналындағы тақ элементтер санын
анықтау.

#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#define n 3
main()
{clrscr();randomize();int a[n][n],i,j,k=0;
for (i=0;i<n;i++)
{for (j=0;j<n;j++)
          {a[i][j]=random(10);
          printf("%d t",a[i][j]);}
printf("n");
}
for (i=0;i<n;i++)
for (j=0;j<n;j++)
  if ((i==j)&&(a[i][j]%2!=0)) k++;
printf("k=%d n",k);
}
Матрицаны тасымалдау
                     N=4 үшін:
a00 a01 a02 a03         i=0 j=1 a01= a10
a10 a11 a12 a13
                             j=2 a02= a20
a20 a21 a22 a23
                             j=3 a03= a30
a30 a31 a32 a33         i=1 j=2 a12= a21

                              j=3 a13= a31
                        i=2 j=3 a23= a32
Матрицаны тасымалдау.
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#define n 4
main()
{clrscr();randomize();int a[n][n],i,j,t;
for (i=0;i<n;i++)
{for (j=0;j<n;j++)
           {a[i][j]=random(10);
           printf("%d t ",a[i][j]);}
printf("n");
}
printf("n");
for (i=0;i<n-1;i++)
for (j=i+1;j<n;j++)
           {t=a[i][j];
           a[i][j]=a[j][i];
           a[j][i]=t;}
for (i=0;i<n;i++)
{for (j=0;j<n;j++)
           printf("%d t",a[i][j]);
printf("n");
}
Матрицаның әрбір жолының ең кіші элементін табу.
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#define n 4
main()
{clrscr();randomize();int a[n][n],i,j,min;
for (i=0;i<n;i++)
{for (j=0;j<n;j++)
          {a[i][j]=random(10);
          printf("%d t ",a[i][j]);}
printf("n");
}
printf("n");
for (i=0;i<n;i++)
{min=a[i][0];
for (j=1;j<n;j++)
          if (min>a[i][j]) min=a[i][j];
printf("%d n",min);
}
}

More Related Content

Featured

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 

Featured (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

ProgrammerAzharKubasheva

  • 2. Сабақ жоспары  Екі өлшемді массив элементтерін сипаттау  Екі өлшемді массив элементтерін енгізу және баспалау тәсілдері  Массивтерді өңдеудің базалық алгоритмдері − Массив элементтерінің қосындысы, көбейтіндісін табу; − Қандай да бір шартты қанағаттандыратын элементтер санын анықтау; − Квадрат матрицаның бас және қосалқы диагональ элементтерінің қосындысын табу. − Бас диагональдан төмен не жоғары жатқан элементтер қосындысын, көбейтіндісін табу т.б.
  • 3. Екі өлшемді массив элементтерін сипаттау <тип> <жиым атауы> [жол саны] [баған саны] мысалы, int a[3][4] – бүтін сандар жиымы a00 a01 a02 a03 a10 a11 a12 a13 a20 a21 a22 a23 float c[2][3] – нақты сандар жиымы
  • 4. Екі өлшемді массив элементтерін енгізу және баспалау тәсілдері
  • 5. Екі өлшемді массив элементтерін баспалаудың 1-тәсілі #include<stdio.h> #include<conio.h> #define n 3 #define m 4 main() {clrscr();int a[n][m],i,j; a[0][0]=4;a[0][1]=8;a[0][2]=-6;a[0][3]=9; a[1][0]=5;a[1][1]=3;a[1][2]=-2;a[1][3]=7; a[2][0]=1;a[2][1]=5;a[2][2]=-4;a[2][3]=-9; for (i=0;i<n;i++) {for (j=0;j<m;j++) printf("%d t",a[i][j]); printf("n"); } }
  • 6. Екі өлшемді массив элементтерін баспалаудың 2-тәсілі #include<stdio.h> #include<conio.h> #define n 3 #define m 4 main() {clrscr();int a[n][m]={4,8,-6,9,-5,12,6,-2,3,-7,5,6}, i, j; for (i=0; i<n; i++) {for (j=0; j<m; j++) printf ("%d t", a[i] [j]) ; Printf ("n"); } }
  • 7. 3- тәсіл: Жиымды кездейсоқ сандармен толтыру #include<stdio.h> #include<stdlib.h> #include<conio.h> #define n 3 #define m 4 main() {clrscr();randomize();int a[n][m],i,j; for (i=0;i<n;i++) {for (j=0;j<m;j++)} {a[i][j]=random(10); printf("%d t",a[i][j]);} printf("n"); } }
  • 9. Екі өлшемді массив элементтерінің қосындысын, көбейтіндісін табу . #include<stdio.h> #include<conio.h> #define n 3 #define m 4 main() {clrscr();int a[n][m]={4,8,-6,9,-5,12,6,-2,3,-7,5,6},i,j,s=0,p=1; for (i=0;i<n;i++) {for (j=0;j<m;j++) printf("%d t",a[i][j]); printf("n"); } for (i=0;i<n;i++) for (j=0;j<m;j++) {s+=a[i][j]; p*=a[i][j];} printf("s=%d p=%d n",s,p); }
  • 10. Екі өлшемді массивтің оң элементтерінің саны мен теріс элементтерінің қосындысын табу. #include<stdio.h> #include<stdlib.h> #include<conio.h> #define n 3 #define m 4 main() {clrscr();randomize();int a[n][m],i,j,k=0,s=0; for (i=0;i<n;i++) {for (j=0;j<m;j++) {a[i][j]=random(10); printf("%d t",a[i][j]);} printf("n"); } for (i=0;i<n;i++) for (j=0;j<m;j++) if (a[i][j]>0) k++;else s+=a[i][j];} printf("s=%d k=%d n",s,k); }
  • 11. Екі өлшемді массивтің баған элементтерінің қосындысын табу. #include<stdio.h> #include<stdlib.h> #include<conio.h> #define n 3 #define m 4 main() {clrscr();randomize();int a[n][m],i,j,s; for (i=0;i<n;i++) {for (j=0;j<m;j++) {a[i][j]=random(10); printf("%d t",a[i][j]);} printf("n"); } for (j=0;j<m;j++) {s=0; for (i=0;i<n;i++) s+=a[i][j]; printf("%d n",s); } }
  • 12. Квадрат матрицаның бас диагональ элементтерінің қосындысы мен көбейтіндісін табу. #include<stdio.h> #include<stdlib.h> #include<conio.h> #define n 3 main() {clrscr();randomize();int a[n][n],i,j,s=0,p=1; for (i=0;i<n;i++) {for (j=0;j<n;j++) {a[i][j]=random(10); printf("%d t",a[i][j]);} printf("n"); } for (i=0;i<n;i++) for (j=0;j<n;j++) if (i==j) {s+=a[i][j];p*=a[i][j];} printf("s=%d p=%d n",s,p);
  • 13. Квадрат матрицаның бас диагональдан жоғары жатқан элементтерінің қосындысын табу. #include<stdio.h> #include<stdlib.h> #include<conio.h> #define n 3 main() {clrscr();randomize();int a[n][n],i,j,s=0; for (i=0;i<n;i++) {for (j=0;j<n;j++) {a[i][j]=random(10); printf("%d t",a[i][j]);} printf("n"); } for (i=0;i<n;i++) for (j=0;j<n;j++) if (i<j) s+=a[i][j]; printf("s=%d n",s); }
  • 14. Квадрат матрицаның қосалқы диагональ элементтерінің қосындысын табу. #include<stdio.h> #include<stdlib.h> #include<conio.h> #define n 3 main() {clrscr();randomize();int a[n][n],i,j,s=0; for (i=0;i<n;i++) {for (j=0;j<n;j++) {a[i][j]=random(10); printf("%d t",a[i][j]);} printf("n"); } for (i=0;i<n;i++) s+=a[i][n-1-i]; printf("s=%d n",s);
  • 15. Квадрат матрицаның бас диагоналындағы тақ элементтер санын анықтау. #include<stdio.h> #include<stdlib.h> #include<conio.h> #define n 3 main() {clrscr();randomize();int a[n][n],i,j,k=0; for (i=0;i<n;i++) {for (j=0;j<n;j++) {a[i][j]=random(10); printf("%d t",a[i][j]);} printf("n"); } for (i=0;i<n;i++) for (j=0;j<n;j++) if ((i==j)&&(a[i][j]%2!=0)) k++; printf("k=%d n",k); }
  • 16. Матрицаны тасымалдау N=4 үшін: a00 a01 a02 a03  i=0 j=1 a01= a10 a10 a11 a12 a13 j=2 a02= a20 a20 a21 a22 a23 j=3 a03= a30 a30 a31 a32 a33  i=1 j=2 a12= a21 j=3 a13= a31  i=2 j=3 a23= a32
  • 17. Матрицаны тасымалдау. #include<stdio.h> #include<stdlib.h> #include<conio.h> #define n 4 main() {clrscr();randomize();int a[n][n],i,j,t; for (i=0;i<n;i++) {for (j=0;j<n;j++) {a[i][j]=random(10); printf("%d t ",a[i][j]);} printf("n"); } printf("n"); for (i=0;i<n-1;i++) for (j=i+1;j<n;j++) {t=a[i][j]; a[i][j]=a[j][i]; a[j][i]=t;} for (i=0;i<n;i++) {for (j=0;j<n;j++) printf("%d t",a[i][j]); printf("n"); }
  • 18. Матрицаның әрбір жолының ең кіші элементін табу. #include<stdio.h> #include<stdlib.h> #include<conio.h> #define n 4 main() {clrscr();randomize();int a[n][n],i,j,min; for (i=0;i<n;i++) {for (j=0;j<n;j++) {a[i][j]=random(10); printf("%d t ",a[i][j]);} printf("n"); } printf("n"); for (i=0;i<n;i++) {min=a[i][0]; for (j=1;j<n;j++) if (min>a[i][j]) min=a[i][j]; printf("%d n",min); } }