Update 'du3/program.c'

This commit is contained in:
Anzhelika Nikolaieva 2023-03-07 21:39:43 +00:00
parent 5d70180348
commit 72e86465e0

View File

@ -1,24 +1,54 @@
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
#include <assert.h>
#define VELKOST_POLA 50
#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;
}
int a = 0;
char r[SIZE];
memset(r, 0, SIZE);
char* stav_r = fgets(r, SIZE, stdin);
bool x0 = true;
printf("y = %d\n", y);
return 0;
if (stav_r == NULL){
break;
}
if (x0 = true){
x[a] = strtof(r);
}
if (r[0] == '\n'){
x0 = false;
}
if (pipa(r[0])){
if (a < 1 && n > -1){
printf("Nepodarilo sa nacitat zaklad x\n" );
break;
}
printf"Nepodarilo sa nacitat polynom na %d mieste.\n", a);
break;
}
if (x0 = true){
a = a+1;
}
if (a == 2){
printf("Vysledok je: %.2f\n", x[1]);
return 0;
}
long int b;
b = x[0];
long int c;
c = x[1];
long int results = 0;
int d = 0;
while (d < a-2){
d++;
results = b*c+x[d+1];
c = results;
}
printf("Vysledok: %.2f\n", results);
return 0;
}