/* 1 */
#include
struct Point {
double x, y;
};
struct Point fillPoint(unsigned short int id) {
struct Point p;
printf("Точка №%d\n", id);
printf("x = ");
scanf("%lf", &(p.x));
printf("y = ");
scanf("%lf", &(p.y));
return p;
}
int pointsInSameQuarter(struct Point p1, struct Point p2) {
if ( ( (p1.x > 0) && (p2.x > 0) ) || ( (p1.x < 0) && (p2.x < 0) ) ) { /* xs */
if ( ( (p1.y > 0) && (p2.y > 0) ) || ( (p1.y < 0) && (p2.y < 0) ) ) { /* ys */
return 1;
}
}
return 0;
}
int main() {
struct Point p1 = fillPoint(1), p2 = fillPoint(2);
printf("Точки %sв одной координатной четверти", (pointsInSameQuarter(p1, p2) ? "" : "не "));
}
/* 2 */
#include
#include
int main() {
int x;
printf("x = ");
scanf("%d", &x);
float r;
int c = 0;
for (int d = 1; d <= x; d++) {<br> r = (float) x / d;
if ( ceilf(r) == r ) c++;
}
printf("Ответ: %d", c);
}