You are on page 1of 2

Problema 1:

void afisare(int x, int y, int k)


{
for (int i=x; i<=y; i+=k, cout<<"* ")
for (int j=i; j<=i+k-1; j++)
if (j<=y)
cout<<j<<' ';
}

Problema 2:

#include <iostream>

using namespace std;

int main()
{
int x, aux, i, j, n=0, mat[11][11];
cin>>x;
aux=x;
while (aux)
{
aux/=10;
n++;
}
j=n;
while (x)
{
for (i=1; i<=n; i++)
mat[i][j]=x%10;
x/=10;
j--;
}
for (i=1; i<=n; i++, cout<<'\n')
for (j=1; j<=n; j++)
cout<<mat[i][j]<<' ';
return 0;
}

Problema 3:

#include <iostream>
#include <fstream>

using namespace std;

ifstream fin ("bac.in");

int main()
{
int x, ok=1;
while (fin>>x)
if (x%2==0)
{
cout<<x<<' ';
ok=0;
}
if (ok)
cout<<"nu exista";
return 0;
}

You might also like