Update 'cv3/program.c'
This commit is contained in:
		
							parent
							
								
									1369c121ed
								
							
						
					
					
						commit
						3231af40ae
					
				@ -15,12 +15,21 @@ int main() {
 | 
			
		||||
    double coefficients[MAX_COEFFICIENTS];
 | 
			
		||||
    int count = 0;
 | 
			
		||||
 | 
			
		||||
    scanf("%lf", &x);
 | 
			
		||||
    if (scanf("%lf", &x) != 1) {
 | 
			
		||||
        printf("Nepodarilo sa nacitat hodnotu x.\n");
 | 
			
		||||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    while (scanf("%lf", &coef) == 1) {
 | 
			
		||||
        coefficients[count++] = coef;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    if (!feof(stdin)) {
 | 
			
		||||
        printf("Nepodarilo sa nacitat polynom na %d mieste.\n", count + 1);
 | 
			
		||||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    double result = evaluatePolynomial(x, coefficients, count);
 | 
			
		||||
    printf("Vysledok je: %.2f\n", result);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user