Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

Problema 1:

int identice(int n)
{
int cif=n%10;
n/=10;
while (n)
{
if (n%10!=cif)
return 0;
cif=n%10;
n/=10;
}
return 1;
}

Problema 2:

#include <iostream>

using namespace std;

int main()
{
int n, m, i, j, mat[101][101];
cin>>n>>m;
for (i=1; i<=n; i++)
for (j=1; j<=m; j++)
mat[i][j]=(i*j)%10;
for (i=1; i<=n; i++, cout<<'\n')
for (j=1; j<=m; j++)
cout<<mat[i][j]<<' ';
return 0;
}

Problema 3:

#include <iostream>
#include <fstream>

using namespace std;

ifstream fin ("bac.in");

int main()
{
int n, i, x, maxim=0;
fin>>n;
for (i=1; i<=n; i++)
{
fin>>x;
if (x>maxim)
maxim=x;
cout<<maxim<<' ';
}
return 0;
}

You might also like