88. Berilgan funksiyani dasturini tuzing
#include #include using namespace std; int main()
{
float a,b,z1,z2,z3; cout<<"a="; cin>>a; cout<<"b="; cin>>b; cout<<"x="; cin>>x; cout<<"y="; cin>>y; if(b>a){
z1=pow(a,2)*b*x-x*a*pow(b,2); cout<<"z1="<}
else if(a=b){
z2=x*y-pow(tan(fabs(x-4)),2); cout<<"z2="<}
else{ z3=pow(x,3)*1./(3+x)+(4*pow(x,2))*1./(2+ x)*pow(y,3);
cout<<"z3="<}
return 0;
}
46 Uch xonali son berilgan. Uning o‘nlik va birlik xonalaridagi raqamlarini almashtirish natijasida hosil bo’lgan son chop etilsin.
using namespace std; int main()
{
int a{327}, a1, a2, a3; a1 = a / 100;
a2 = (a % 100) / 10; a3 = a % 10;
int result = (a1*100) + (a3*10) + a2;
cout<<"Berilgan Son = "<cout<<"Yangi Son = "<return 0;
}
| |
47. a va b butun sonlar berilgan. (a) a dan b gacha bo‘lgan sonlarning kvadratlar yig‘indisi topilsin
#include int main() {
int a{2}, b{12}, result; for(int c=a;c{
c *= c; result += a;
}
std::cout<<"A dan B gacha sonlar kvadratini yig'indisi = "<std::cin.get(); return 0;
}
|
45. n o‘lchamli a massiv berilgan(n-juft son). (indekslari o‘sish tartibida) Juft indeksdagi elementlari chiqarilsin. a2,a4,…,an
#include int main() {
int array[8] = {1, 2, 3, 4, 5, 6, 7, 8};
for(int i=0;i<8;i++) { if(i % 2 == 0)std::cout<return 0;
}
|
32. Berilgan funksiyani dasturini tuzing:
#include #include using namespace std; int main()
{
double x,y,Z,a,b;
cout << "a ni kiriting:"; cin >> a; cout << "b ni kiriting:"; cin >> b; cout << "x ni kiriting:"; cin >> x;
cout << "y ni kiriting:"; cin >> y;
|
29. n o‘lchamli a massiv berilgan. Uning elementlari teskari tartibda chiqarilsin #include
using namespace std; int main()
{
int n;
cout << "n ni kiriting:"; cin >> n; int a[n];
for (int i=0; icout << "a[" << i << "]="; cin >> a[i];
|
|
double z1=a*a*b*x-x*a*b*b; double
z2=(pow(x,3))/(3+x)+((4*x*x)/(2+
x))/(pow(y,3));
double z3=x*y-pow(tan(fabs(x- 4)),2);
if (aelse if (a==b) {Z=z2;} else {Z=z3;}
cout << "Natija: Z=" << Z << endl;
return 0;
}
|
}
cout << "Massiv elementlari teskari tartibda:" << endl;
for (int i=n-1; i>=0; i--) {
cout << "a[" << i << "]=" << a[i] <<
endl;
}
return 0;
}
|
31 a va n sonlari berilgan. Bitta sikldan foydalanib a sonining 1 dan n gacha bo‘lgan darajalari chiqarilsin
#include #include using namespace std; int main()
{int a,n;
cout << "a ni kiriting:"; cin >> a; cout << "n ni kiriting:"; cin >> n; for (int i=1; i<=n; i++) { cout<return 0; }
|
30 Uch xonali son berilgan. U teskari tomondan o‘qigandagi son chop etilsin.
#include using namespace std; int main()
{
int a,a1,a2,a3;
cout << "Uch xonali sonnikiriting:"; cin >> a; a3=a%10; a=a/10; a2=a%10; a=a/10;
a1=a;
cout << "Berilgan sonning taskarisi: " << a3 << a2 << a1 << endl;
return 0;
}
|
24 Berilgan funksiyani dasturini tuzing:
#include using namespace std; int main(){
double F, f1, f2, f3, x, A=-3, B=5; cin>>x;
f1=(x-A)/(1+3*x*x); f2=(A+B)*x-x*x-A*B; f3=(B-x)/4+x*x; if(xF=f1;
else if(A<=x && xelse if(x>=B) F=f3;
cout<<"F = "<}
|
21 n (n>0) butun son berilgan. Dastlabki n ta musbat toq sonlarni saqlaydigan n o‘lchamli butun sonli massiv tashkil etilsin
#include using namespace std;
int main()
{
int n, i; cin>>n; int a[100];
for(int i=0; ifor (int i=0; icout << "a[" << i << "]=" << a[i] <<
endl;
return 0;
}
|
23 n butun soni berilgan (n>0). 1!+2!+…+n!. Bitta sikldan foydalanib yig‘indi hisoblansin #include
using namespace std; int main(){
int n; cin>>n;
double s=0, f=1; for(int i=1; i<=n; i++){
f=f*i; s+=f;
}
cout<}
|
22 Uch xonali son berilgan, uning oxirgi va o‘rta xonasidagi raqamlari chop etilsin #include
using namespace std; int main(){
int n; cin>>n;
cout<}
|
Do'stlaringiz bilan baham: |