відповідь: 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+
-
*
/
%
пояснення:
Поделитесь своими знаниями, ответьте на вопрос:
#include "stdafx.h"
#include <conio.h>
void swap(short &a, short &b) {
short c = a;
a = b;
b = c;
}
void sort(short &a, short &b, short &c)
{
short min = a,
max = c;
if (min > b) min = b;
if (min > c) min = c;
if (max < a) max = a;
if (max < b) max = b;
b = a + b + c - min - max;
a = min;
c = max;
}
int main()
{
short a1, b1, c1, a2, b2, c2;
scanf_s("%hd %hd %hd", &a1, &b1, &c1);
scanf_s("%hd %hd %hd", &a2, &b2, &c2);
sort(a1, b1, c1);
sort(a2, b2, c2);
if ((a1 == a2) && (b1 == b2) && (c1 == c2))
printf("Boxes are equal");
else
if ((a1 <= a2) && (b1 <= b2) && (c1 <= c2))
printf_s("The first box is smaller than the second one");
else
if ((a2 <= a1) && (b2 <= b1) && (c2 <= c1))
printf_s("The first box is larger than the second one");
else
printf_s("Boxes are incomparable");
_getch();
return 0;
}