1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char ** argv) {
if (argc != 1+11) {
fprintf(stderr, "uporaba: %s <stevilka> (=) <stevilka>(x) (+) <stevilka>(y) (+) <stevilka>(z) (;) <stevilka> (=) <stevilka>(x) (+) <stevilka>(y) (+) <stevilka>(z) <min> <max> <step>\nprimer: %s 53 3 2 5 91 5 3 9 0 100 1\n", argv[0], argv[0]);
return 1;
}
unsigned int i;
double j[3];
double n[8];
double min = atoi(argv[9]);
double max = atoi(argv[10]);
double step = atoi(argv[11]);
for (i = 1; i <= 8; i++)
n[i-1] = atof(argv[i]);
for (j[0] = min; j[0] <= max; j[0]++)
for (j[1] = min; j[1] <= max; j[1]++)
for (j[2] = min; j[2] <= max; j[2]++)
if ((n[0] == n[1] * j[0] + n[2] * j[1] + n[3] * j[2])
&& (n[4] == n[5] * j[0] + n[6] * j[1] + n[7] * j[2]))
fprintf (stdout, "našel: %f = %f * %f + %f * %f + %f * %f ; "
"%f = %f * %f + %f * %f + %f * %f\n", n[0], n[1], j[0], n[2], j[1], n[3], j[2], n[4], n[5], j[0], n[6], j[1], n[7], j[2]);
return 0;
}
|