Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <math.h>
- using namespace std;
- int _tmain(int argc, _TCHAR* argv[])
- {
- setlocale (0,"rus");
- int i, j;
- double a=25.8, b[20], x, s=0, p=1, k;
- for (i=0;i<20;i++)
- {
- k=i;
- b[i]=sqrt(abs(pow(k+1,2)-a));
- }
- for (i=0;i<20;i++)
- {
- if (i>=4 && i<=9)
- s=s+b[i];
- if (b[i]<8.5)
- p=p*b[i];
- cout<<"B["<<i+1<<"]= "<<b[i]<<endl;
- }
- for (j=0;j<6;j++)
- {
- for (i=4;i<9;i++)
- {
- if (b[i]<b[i+1])
- {
- x=b[i];
- b[i]=b[i+1];
- b[i+1]=x;
- }
- }
- }
- cout<<endl;
- cout<<endl;
- cout<<"Измененный массив"<<endl;
- for (i=0;i<20;i++)
- {
- cout<<"B["<<i+1<<"]= "<<b[i]<<endl;
- }
- cout<<"Сумма элементов с номерами 5;10 = "<<s<<endl;
- cout<<"Произведение чисел меньше 8.5 = "<<p<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement