LOL
This commit is contained in:
commit
7fdc695ece
30
program.c
Normal file
30
program.c
Normal file
@ -0,0 +1,30 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
int main () {
|
||||
char* BMW = (char*) calloc (100, sizeof(char));
|
||||
int x;
|
||||
int counter;
|
||||
int numbers [100];
|
||||
for (int i = 0; fgets(BMW, 100, stdin) != NULL; i++){
|
||||
if (!strcmp("\n", BMW) || !strcmp(" ", BMW)) {
|
||||
counter = i;
|
||||
break;
|
||||
}
|
||||
if (i == 0){
|
||||
x = atoi (BMW);
|
||||
}
|
||||
else {
|
||||
numbers [i] = atoi [BMW];
|
||||
}
|
||||
}
|
||||
int result = 0;
|
||||
while (counter > 0){
|
||||
result += pow (x, counter -1) * numbers [counter];
|
||||
counter --;
|
||||
}
|
||||
printf ("Vysledok je: ");
|
||||
printf ("%d\n", result);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user