Как-то так, наверное
Объяснение:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double a, x, b, c, D;
cout<<"Введите a: "; cin >> a;
cout<<"Введите b: "; cin >> b;
cout<<"Введите c: "; cin >> c;
D = pow(b,2)-4*a*c;
if(D>0){
cout << "x1 = " << ((-1)*b+sqrt(D))/(2*a)<<endl;
cout << "x2 = " <<((-1)*b-sqrt(D))/(2*a)<<endl;
}
else if(D==0){
cout << "x = " << ((-1)*b)/(2*a)<<endl;
else{
D*=(-1);
cout<< "x1 = " << ((-1)*b)/(2*a) <<"+"<< (sqrt(D))/(2*a) << "*i" <<endl;
cout<< "x2 = " << ((-1)*b)/(2*a) <<"-"<< (sqrt(D))/(2*a) << "*i" <<endl;
return 0;
Program F90
integer i, j, k, s /0/, x/2/, y/6/, a(7, 7)
do k = 1, 4
do i = x - 1, y + 1
s = s + 1
a(x - 1, i) = s
end do
i = y + 1
do j = x, y + 1
a(j, i) = s
do i = y, x - 1, -1
a(y + 1, i) = s
i = x - 1
do j = y, x, -1
x = x + 1
y = y - 1
Print *, 'massive 15 = '
Write(*, '(7i5)') ((a(i, j), j=1, 7), i=1, 7)
End Program
Как-то так, наверное
Объяснение:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double a, x, b, c, D;
cout<<"Введите a: "; cin >> a;
cout<<"Введите b: "; cin >> b;
cout<<"Введите c: "; cin >> c;
D = pow(b,2)-4*a*c;
if(D>0){
cout << "x1 = " << ((-1)*b+sqrt(D))/(2*a)<<endl;
cout << "x2 = " <<((-1)*b-sqrt(D))/(2*a)<<endl;
}
else if(D==0){
cout << "x = " << ((-1)*b)/(2*a)<<endl;
}
else{
D*=(-1);
cout<< "x1 = " << ((-1)*b)/(2*a) <<"+"<< (sqrt(D))/(2*a) << "*i" <<endl;
cout<< "x2 = " << ((-1)*b)/(2*a) <<"-"<< (sqrt(D))/(2*a) << "*i" <<endl;
}
return 0;
}
Program F90
integer i, j, k, s /0/, x/2/, y/6/, a(7, 7)
do k = 1, 4
do i = x - 1, y + 1
s = s + 1
a(x - 1, i) = s
end do
i = y + 1
do j = x, y + 1
s = s + 1
a(j, i) = s
end do
do i = y, x - 1, -1
s = s + 1
a(y + 1, i) = s
end do
i = x - 1
do j = y, x, -1
s = s + 1
a(j, i) = s
end do
x = x + 1
y = y - 1
end do
Print *, 'massive 15 = '
Write(*, '(7i5)') ((a(i, j), j=1, 7), i=1, 7)
End Program