Помогите переделать из Паскаля в СИ
program lab ;
var a,b,y:real;
x:integer;
begin
a:= 6.72; b:=4.85;
write('vvedite x='); readln(x);
case x of
1:y:=1+sqrt(a+abs(x));
7:y:=2+a*a*x*x+exp(x);
5:y:=x*sqrt(1+b*ln(a*a*x));
else
begin
writeln('znachenie x zadano neverno');
writeln('nagmi Enter');
readln;
exit;
end;
end;
writeln('x=', x:2,'y=',y:5:2);
readln;
end.
Answers & Comments
#include <math.h>
#include <stdlib.h>
#include <conio.h>
int main() {
double a, b, y;
int x;
a = 6.72f;
b = 4.85f;
printf("vvedite x=");
scanf("%d", &x);
switch (x) {
case 1: y = 1 + sqrt(a + abs(x)); break;
case 7: y = 2 + a*a*x*x + exp(x); break;
case 5: y = x*sqrt(1+b*log(a*a*x)); break;
default:
printf("znachenie x zadano neverno\n");
printf("nagmi Enter\n");
getch();
return 0;
}
printf("x=%2dy=%5.2lf", x, y);
getch();
return 0;
}