відповідь: function showresult(choise){
var n1=parsefloat(document.getelementbyid('num1').value);
var n2=parsefloat(document.getelementbyid('num2').value);
var r;
var c=choise;
switch(c)
{
case '1':
r=n1+n2;
break;
case '2':
r=n1-n2;
case '3':
r=n1*n2;
case '4':
r=n1/n2;
case '5':
r=n2*100/n1;
default:
}
document.getelementbyid('result').value=r;
calculator
+
-
*
/
%
пояснення:
1)
program gt1;
var x,y:real;
begin
x:=-3.1;
while x<1 do
x:=x+0.1;
y:=4*x*x*x-2*x*x+5;
writeln(y);
end;
end.
2)
program gt2;
var k,i:integer;
k:=0;
for i:=11 to 20 do
if(i mod 2=1)then k:=k+1;
writeln(k);
3)
program gt3;
var s,i:integer;
s:=0;
for i:=1 to 100 do
if(i mod 2=0)then s:=s+i;
writeln(s);
4)
program gt4;
var sum,a:real;
i,n:integer;
sum:=0;
a:=0;
readln(n);
for i:=1 to n do begin
a:=1/((3*n-2)-(3*n+1));
Sum:=sum + a;
n:=n+1;
write(sum);
5)
program gt5;
var n,k:integer;
while n>0 do
n:=n div 10;
k:=k+1;
відповідь: function showresult(choise){
var n1=parsefloat(document.getelementbyid('num1').value);
var n2=parsefloat(document.getelementbyid('num2').value);
var r;
var c=choise;
switch(c)
{
case '1':
r=n1+n2;
break;
case '2':
r=n1-n2;
break;
case '3':
r=n1*n2;
break;
case '4':
r=n1/n2;
break;
case '5':
r=n2*100/n1;
break;
default:
break;
}
document.getelementbyid('result').value=r;
}
calculator
my calculator first number second number result+
-
*
/
%
пояснення:
1)
program gt1;
var x,y:real;
begin
x:=-3.1;
while x<1 do
begin
x:=x+0.1;
y:=4*x*x*x-2*x*x+5;
writeln(y);
end;
end.
2)
program gt2;
var k,i:integer;
begin
k:=0;
for i:=11 to 20 do
begin
if(i mod 2=1)then k:=k+1;
end;
writeln(k);
end.
3)
program gt3;
var s,i:integer;
begin
s:=0;
for i:=1 to 100 do
begin
if(i mod 2=0)then s:=s+i;
end;
writeln(s);
end.
4)
program gt4;
var sum,a:real;
i,n:integer;
begin
sum:=0;
a:=0;
readln(n);
for i:=1 to n do begin
a:=1/((3*n-2)-(3*n+1));
Sum:=sum + a;
n:=n+1;
end;
write(sum);
end.
5)
program gt5;
var n,k:integer;
begin
k:=0;
while n>0 do
begin
n:=n div 10;
k:=k+1;
end;
writeln(k);
end.