#include <iostream>
#include <iomanip>
#include <cmath>
int main()
{
float
x, y, b, a;
std::cout << "Введите X, A, B: ";
std::cin >> x >> a >> b;
y = 1.5*pow(cos(x), 2) + b*pow(a, 1.5*x) * x;
std::cout << "Значение функции = " << std::setprecision(3) << y;
return 0;
}
Pascal
var
a,s : integer;
begin
s := 0;
readln (a);
While a <> 0 do
begin
s := s +a;
readln (a);
end;
writeln (s);
end.
Const int neededInputs = 8;
try
{
int counterNegativeNumbers = 0;
int counterInLoop = 0;
while (counterInLoop < neededInputs)
{
Console.WriteLine("Type a number, please ");
int number = Int32.Parse(Console.ReadLine());
if(number < 1)
counterNegativeNumbers++;
counterInLoop++;
}
Console.WriteLine(String.Format("You`ve written {0} negative or zero numbers", counterNegativeNumbers));
}
catch(FormatException ex)
{
Console.WriteLine("Invalid format of the number");
}