0
program for average two number
program
3 ответов
+ 1
avoid arithmetic overflow by dividing first then adding.
use x/2 + y/2
instead of (x+y)/2
0
#include <iostream>
void main()
{
double x, y;
std::cin >> x >> y;
std::cout << (x+y)/2;
}
0
#include<stdio.h>
int main()
{
double x,y,avj;
scanf("%lf%lf",&x,&y);
avj=(x+y)/2;
printf("%lf",avj);
return 0;
}