Va rog sa imi rezolvati si mie de aici cate puteti.
Ofer coronița si 25 pct
Răspunsuri la întrebare
1.
#include <iostream>
using namespace std;
int main()
{
unsigned int x, y, z;
for (x=5; x<=9; x++) cout << 2 << x << 4 << " ";
for (y=2; y<=6; y++)
for (z=1; z<=9; z++) cout << y << 3 << z << " ";
return 0;
}
2.
#include <iostream>
using namespace std;
int main()
{
unsigned int a, c;
for (a=1; a<=9; a++)
for (c=0; c<=9; c++)
cout << a << 1 << c << " ";
cout << a << 3 << c << " ";
cout << a << 7 << c << " ";
return 0;
}
3.
#include <iostream>
using namespace std;
int main()
{
unsigned int x, y;
for (x=0; x<=9; x++)
for (y=0; y<=9; y++)
if ((3*1000+x*100+y*10+7)%17==0) cout << 3 << x << y << 7 << " ";
return 0;
}
4.
#include <iostream>
using namespace std;
int main()
{
unsigned int x, y;
for (x=1; x<=9; x++)
for (y=0; y<=9; y++)
if ((x+y+4)%2==0) cout << x << 4 << y << " ";
return 0;
}
5.
#include <iostream>
using namespace std;
int main()
{
unsigned int a, b, p=1;
for (a=3; a<=9; a=a+3)
for (b=0; b<=9; b++)
p=p*(a*100+b*10+1);
cout << p;
return 0;
}
6. a.
#include <iostream>
using namespace std;
int main()
{
unsigned int x, x1, s, nr=0;
cin >> x;
while (x!=30)
{
s=0;
x1=x;
while (x1!=0)
{
s=s+x1%10;
x1=x1/10;
}
if (s%2==1) nr++;
cin >> x;
}
cout << nr;
return 0;
}
b.
#include <iostream>
using namespace std;
int main()
{
unsigned int x, x1, s=0, ogl;
cin >> x;
while (x!=30)
{
ogl=0;
x1=x;
while (x1!=0)
{
ogl=ogl*10+x1%10;
x1=x1/10;
}
if (ogl==x && ogl%2==0) s=s+ogl;
cin >> x;
}
cout << s;
return 0;
}
c.
#include <iostream>
using namespace std;
int main()
{
unsigned int x, x1, s=0, nr=0, nr1;
cin >> x;
while (x!=30)
{
nr1=0;
x1=x;
while (x1!=0)
{
if (x1%10==1) nr1++;
x1=x1/10;
}
if (nr1==2)
{
s=s+x;
nr++;
}
cin >> x;
}
cout << (float)s/nr;
return 0;
}
d.
#include <iostream>
using namespace std;
int main()
{
unsigned int x, nr=0, x1, nrc;
cin >> x;
while (x!=30)
{
x1=x;
while (x1!=0)
{
if(x1%10%3==0) nrc++;
x1=x1/10;
}
if (nrc==2) nr++;
cin >> x;
}
cout << nr;
return 0;
}