1-misol. Yig’indini hisoblovchi dastur tuzing. #include #include using namespace std;
int main(){
float S=0,P=1,x;
int n;
cin >> n >> x;
for(int k=1;k<=n;k++){
P=1;
for(int m=1;m<=k+7;m++){
P *= (m*m-9)/(m-2);
}
S += pow(-1, 3*k+1)/((k-5)*pow(x,k)) * P;
}
cout << S << endl;
}
2-misol. Yig’indini hisoblovchi dastur tuzing. Yechilishi:
#include #include using namespace std;
int main(){
double p=1,s=1,x;
int n,j;
cin >> n >> x;
for(int i=1;i<=n;i++){
p=1;
j = i;
while(j){
p*=j;
j--;
}
s+=(2*i+1)*pow(x,2*i)/p;
}
cout << s << endl;
}
Qora ekran:
Dastur natijasi:
n=6
x=0.1
1.03025
n=7
x=1.5
51.8036
3-misol.Ichma ich joylashgan takrorlash operatorlaridan foydalanib rasmda ko’rsatilganlarni chop qiluvchi dastur tuzing! 1
2 3
4 5 6
7 8 9 10
Yechilishi:
#include using namespace std;
int main(){
int k=1;
for(int i=1;i<=4;i++){
for(int j=1;j<=i;j++){
cout << k << " ";
k++;
}
cout << endl;
}
}
Natija: