This commit is contained in:
Anzhelika Nikolaieva 2023-03-07 14:40:39 +01:00
parent 740c929e72
commit 256e70de10
2 changed files with 18 additions and 11 deletions

View File

@ -1,11 +0,0 @@
#include <stdio.h>
int value = 0;
int r = scanf("%d", value);
if (r == 1){
printf("Uspesne som nacital hodnotu %d\n", value);
}
else {
printf("Nacitanie sa neporadilo. V premennej value ostala povodna hodnota. \n");
}

View File

@ -3,4 +3,22 @@
#include <string.h>
#define VELKOST_POLA 52
int main(){
int x[6], i, j, k;
int a[6] = {3, 5, 2, 4, 1, 6};
printf("Enter the values of x: \n");
for(i = 0; i < 6; i++){
scanf("%d", &x[i]);
}
int y = 0;
for(j = 5; j >= 0; j--){
k = 1;
for(i = 0; i < j; i++){
k = k*x[i];
}
y = y + a[j]*k;
}
printf("y = %d\n", y);
return 0;
}