Изменить 'a1/program.c'
This commit is contained in:
parent
92c995a25b
commit
536ed2e0cc
54
a1/program.c
54
a1/program.c
@ -4,29 +4,31 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
int main () {
|
int main () {
|
||||||
char* BMW = (char*) calloc (100, sizeof(char));
|
char* input = (char*) calloc (100, sizeof(char));
|
||||||
int x;
|
int x;
|
||||||
int counter = 0;
|
char* ptr;
|
||||||
int numbers [100];
|
int counter = 0;
|
||||||
for (int i = 0; fgets(BMW, 100, stdin) != NULL; i++){
|
int numbers [100];
|
||||||
if (!strcmp("\n", BMW)) {
|
for (int i = 0; fgets(input, 100, stdin) != NULL; i++){
|
||||||
counter = i;
|
if (!strcmp("\n", input)) {
|
||||||
break;
|
counter = i;
|
||||||
}
|
break;
|
||||||
if (i == 0){
|
}
|
||||||
x = atoi (BMW);
|
if (i == 0){
|
||||||
}
|
x = (int)strtol(input, &ptr, 10);
|
||||||
else {
|
}
|
||||||
numbers [i] = atoi (BMW);
|
else {
|
||||||
}
|
numbers [i] = (int)strtol(input, &ptr, 10);
|
||||||
}
|
}
|
||||||
int result = 0;
|
counter = i;
|
||||||
while (counter > 0){
|
}
|
||||||
result += pow (x, counter -1) * numbers [counter];
|
int result = 0;
|
||||||
counter --;
|
while (counter > 0){
|
||||||
}
|
result += (int)pow (x, counter -1) * numbers [counter];
|
||||||
printf ("Vysledok je: ");
|
counter--;
|
||||||
printf ("%d\n", &result);
|
}
|
||||||
free(BMW);
|
printf ("Vysledok je: ");
|
||||||
return 0;
|
printf ("%d\n", result);
|
||||||
}
|
free(input);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user