a IX-a A27 lecții INFORMATICĂ | 34 lecții T.I.C.
Informatică
Lectia 00001   |   Lectia 00   |   Lectia 01   |   Lectia 02   |   Lectia 03   |   Lectia 04   |   Lectia 05   |   Lectia 06   |   Lectia 07   |   Lectia 08   |   Lectia 09   |   Lectia 10   |   Lectia 101   |   Lectia 102   |   Lectia 103   |   Lectia 11   |   Lectia 11_2   |   Lectia 12   |   Lectia 12_2   |   Lectia 12_3   |   Lectia 12_4   |   Lectia 12_5   |   Lectia 13   |   Lectia 14   |   Lectia 17
Lectia 18   |   Lectia 19
T.I.C.

Lectia 01   |   Lectia 02   |   Lectia 03   |   Lectia 04
Lectia 05   |   Lectia 06   |   Lectia 07   |   Lectia 08   |   Lectia 09
Lectia 10   |   Lectia 11   |   Lectia 12   |   Lectia 13   |   Lectia 14   |   Lectia 15   |   Lectia 16   |   Lectia 17   |   Lectia 18   |   Lectia 19   |   Lectia 19   |   Lectia 20   |   Lectia 23   |   Lectia 24   |   Lectia 26   |   Lectia 27   |   Lectia 28   |   Lectia 29   |   Lectia 30_2   |   Lectia 31   |   Lectia 32   |   Lectia 33   |   Lectia 34   |   Lectia 35   |   Lectia 36
a IX-a B0 lecții INFORMATICĂ | 0 lecții T.I.C.
a IX-a C0 lecții INFORMATICĂ | 29 lecții T.I.C.
T.I.C.
Lectia 01   |   Lectia 02   |   Lectia 03   |   Lectia 04
Lectia 05   |   Lectia 06   |   Lectia 07   |   Lectia 08
Lectia 10   |   Lectia 12   |   Lectia 13   |   Lectia 14   |   Lectia 15   |   Lectia 16   |   Lectia 17   |   Lecția 18   |   Lectia 19   |   Lectia 20   |   Lectia 21   |   Lectia 22   |   Lectia 23   |   Lectia 24   |   Lectia 25   |   Lectia 26   |   Lectia 27   |   Lectia 28   |   Lectia 29   |   Lectia 30   |   Lectia 31
a IX-a D0 lecții INFORMATICĂ | 0 lecții T.I.C.
a IX-a E0 lecții INFORMATICĂ | 0 lecții T.I.C.
a X-a A6 lecții INFORMATICĂ | 29 lecții T.I.C.
Opțional
Fișa 01   |   Fișa 02   |   Fișa 03   |   Fișa 04   |   Fișa 05   |   Lectia 20
T.I.C.

Lectia 07   |   Lectia 08   |   Lectia 09   |   Lectia 10   |   Lectia 11   |   Lectia 12   |   Lectia 13   |   Lectia 14
Lecția 14_1
Lectia 15
Lectia 16   |   Lectia 17   |   Lectia 19   |   Lectia 20
Lectia 21   |   Lecția 22   |   Lectia 23   |   Lectia 24   |   Lectia 25   |   Lectia 26   |   Lectia 27   |   Lectia 28
Lectia 29   |   Lectia 30   |   Lectia 31   |   Lectia 32   |   Lectia 33   |   Lectia 34   |   Lectia 35
a X-a B0 lecții INFORMATICĂ | 0 lecții T.I.C.
a X-a C0 lecții INFORMATICĂ | 0 lecții T.I.C.
a X-a D0 lecții INFORMATICĂ | 0 lecții T.I.C.
a XI-a A30 lecții INFORMATICĂ | 0 lecții T.I.C.
Informatică
Lectia 07   |   Lectia 08
Lectia 08 --- [ 2 Probleme rezolvate ]
1. Sa se scrie un program C++ care citeste o matrice cu n linii si m coloane si determina cate elemente din matrice au prima cifra para.
Propune o soluție

S
o
l
u
ț
i
a:
Introdu următorul text: 78125890
#include <iostream>
using namespace std;
int x[50][50], n, m;
void citire(int x[50][50], int n, int m)
{
for(int i=1;i<=n;i++)
    for(int j=1;j<=m;j++)
{
cout<<"x["<<i<<"]["<<j<<"]=";
cin>>x[i][j];
}
}
void afisare(int x[50][50], int n, int m)
{
for(int i=1;i<=n;i++) {
        for(int j=1;j<=m;j++)
cout<<x[i][j]<<" ";
cout<<endl;
}
}
int PrimaCifra(int a)
{
    while (a>=10)
        a=a/10;
    return a;
}
int main(){
cout<<"n=";
cin>>n;
cout<<"m=";
cin>>m;
citire(x,n,m);
afisare(x,n,m);
int nr=0;
for(int i=1;i<=n;i++)
    for(int j=1;j<=m;j++)
        if(PrimaCifra(x[i][j])%2==0)
             nr++;
    cout<<nr;
return 0;
}

2. Sa se scrie un program C++ care citeste o matrice patratica de dimensiune n care sunt numere intregi de noua cifre si determina care dintre liniile matricei contin mai multe elemente pozitive. Daca sunt mai multe se vor afisa toate.
Propune o soluție

S
o
l
u
ț
i
a:
Introdu următorul text: 508986256
#include <iostream>
using namespace std;
int x[50][50], n;
void citire(int x[50][50], int n)
{
for(int i=1;i<=n;i++)
    for(int j=1;j<=n;j++)
{
cout<<"x["<<i<<"]["<<j<<"]=";
cin>>x[i][j];
}
}
void afisare(int x[50][50], int n)
{
for(int i=1;i<=n;i++) {
        for(int j=1;j<=n;j++)
cout<<x[i][j]<<" ";
cout<<endl;
}
}
int Numar_El_Poz(int x[50][50], int n, int l)
{
    int nr=0;
        for(int j=1;j<=n;j++)
            if (x[l][j]>0)
                nr++;
return nr;
}
int main(){
cout<<"n=";
cin>>n;
citire(x,n);
afisare(x,n);
int l=1, nr_el=Numar_El_Poz(x,n,1);
for(int i=1;i<=n;i++)
        if(Numar_El_Poz(x,n,i)>nr_el)
        {
            nr_el=Numar_El_Poz(x,n,i);
            l=i;
        }
cout<<" liniile ";
for(int i=1;i<=n;i++)
        if(Numar_El_Poz(x,n,i)==nr_el)
            cout<<i<<" ";

return 0;
}


Fii primul care comentează lecţia
     Submit
  |   Lectia 09   |   Lectia 10   |   Lectia 11   |   Lectia 12   |   Lectia 13   |   Lectia 14
Lectia 16   |   Lectia 18   |   Lectia 19   |   Lectia 20   |   Lectia 21
Lectia 23   |   Lectia 24
Lectia 36
Lectia 40   |   Lectia 41   |   Lectia 42   |   Lectia 43   |   Lectia 44   |   Lectia 45   |   Lectia 46   |   Lectia 46_1
Lectia 47   |   Lectia 48   |   Lectia 49   |   Lectia 50   |   Lectia 50_1
Lectia 50_2
a XI-a B0 lecții INFORMATICĂ | 0 lecții T.I.C.
a XI-a C0 lecții INFORMATICĂ | 0 lecții T.I.C.
a XI-a D0 lecții INFORMATICĂ | 15 lecții T.I.C.
T.I.C.
Fişa 01   |   Fişa 02   |   Fişa 03   |   Fişa 04   |   Fişa 05   |   Fişa 06   |   Fişa 07
Fisa C08_2022_1
Lectia 01   |   Lectia 02   |   Lectia 03   |   Lectia 04   |   Lectia 05   |   Lectia 06   |   Lectia 07
a XI-a E0 lecții INFORMATICĂ | 1 lecții T.I.C.
T.I.C.
Fişa 01
a XII-a A2 lecții INFORMATICĂ | 6 lecții T.I.C.
Informatică
Lectia 01   |   Lectia 02
T.I.C.

Fişa 01   |   Fişa 02   |   Fişa 03   |   Fişa 04   |   Fişa 05   |   Fişa 06
a XII-a B0 lecții INFORMATICĂ | 0 lecții T.I.C.
a XII-a C0 lecții INFORMATICĂ | 0 lecții T.I.C.
a XII-a D0 lecții INFORMATICĂ | 0 lecții T.I.C.
a XII-a E0 lecții INFORMATICĂ | 0 lecții T.I.C.
Excelenta A0 lecții INFORMATICĂ | 0 lecții T.I.C.